***Replication Do File for "A Ticking Time Bomb: Restrictions on Abortion Rights and Physical Integrity Rights"
*Nazli Avdan, Amanda Murdie, and Victor Asal"
*Date: 5/16/2024
*Please reach out to murdie@uga.edu with any questions 


clear 
*remember to set your working directory to where the replication dataset is 
cd "C:\Users\murdie\Dropbox\ISA 2023 Naz Victor Abortion\Conditional Acceptance Stage 2024\Replication Data for A Ticking Time Bomb"

use ReplicationDataset.dta, replace
tsset ccode year 

*Analysis Tables in the Manuscript Itself

		*Please see separate do file for making the maps
		
		*Figure 2
		*yearly average - cai_cai1 
		bysort year: egen yearlycai_cai1 = mean(cai_cai1)
		label variable yearlycai_cai1 "Yearly World Mean - Comparative Abortion Index 1"
		line yearlycai_cai1 year if ccode==2 & year>1991 & year <2020
		*graph save "*graph" "Yearly CAI1.gph", replace 

		bysort year: egen yearlycai_cai2 = mean(cai_cai2)
		label variable yearlycai_cai2 "Yearly World Mean - Comparative Abortion Index 2"
		line yearlycai_cai2 year if ccode==2 & year>1991 & year <2020
		*graph save "*graph" "Yearly CAI2.gph", replace 

		*Table 1: Dynamic Model - Abortion Rights and Reduction of social group civil liberties and abortion rights and reduction of human rights 
		*Model 1: theta_mean and cai1
		tsset ccode year
		reg theta_mean  l.theta_mean  l.cai_cai1   l.polity2 l.lnwdi_pop l.lnwdi_gdpcapcon2010 l.intllocation l.civillocation l.v2lgfemleg  l.iarda_chcatpct  l.iarda_isgenpct i.GEO7, robust
		**outreg2 using Table1RR ,  replace word se label
		*Model 2: theta_mean and cai2
		reg theta_mean  l.theta_mean  l.cai_cai2   l.polity2 l.lnwdi_pop l.lnwdi_gdpcapcon2010 l.intllocation l.civillocation l.v2lgfemleg  l.iarda_chcatpct  l.iarda_isgenpct i.GEO7, robust
		**outreg2 using Table1RR ,  append word se label
		*Model 3: social group cl & cai1
		reg v2clsocgrp l.v2clsocgrp   l.cai_cai1   l.polity2 l.lnwdi_pop l.lnwdi_gdpcapcon2010 l.intllocation l.civillocation l.v2lgfemleg  l.iarda_chcatpct  l.iarda_isgenpct i.GEO7, robust
		**outreg2 using Table1RR ,  append word se label
		*Model 4: social group and cai2
		reg v2clsocgrp l.v2clsocgrp   l.cai_cai2   l.polity2 l.lnwdi_pop l.lnwdi_gdpcapcon2010 l.intllocation l.civillocation l.v2lgfemleg  l.iarda_chcatpct  l.iarda_isgenpct i.GEO7, robust
		**outreg2 using Table1RR ,  append  word se label
		*Model 5: theta_mean and cai1, with social group cl included 
		reg theta_mean  l.theta_mean  l.v2clsocgrp  l.cai_cai1   l.polity2 l.lnwdi_pop l.lnwdi_gdpcapcon2010 l.intllocation l.civillocation l.v2lgfemleg  l.iarda_chcatpct  l.iarda_isgenpct i.GEO7, robust
		**outreg2 using Table1RR ,  append word se label
		*Model 6: theta_mean and cai2
		reg theta_mean  l.theta_mean  l.v2clsocgrp  l.cai_cai2   l.polity2 l.lnwdi_pop l.lnwdi_gdpcapcon2010 l.intllocation l.civillocation l.v2lgfemleg  l.iarda_chcatpct  l.iarda_isgenpct i.GEO7, robust
		**outreg2 using Table1RR ,  append word se label

		*Table 2: Causal Mediation Models 
		*treatment is going from median to 3 or median to 2
		mediate (theta_mean ltheta_mean lpolity2 llnwdi_pop llnwdi_gdpcapcon2010 lintllocation lcivillocation lv2lgfemleg liarda_chcatpct  liarda_isgenpct GEO7) (lv2clsocgrp  lpolity2 llnwdi_pop llnwdi_gdpcapcon2010 lintllocation lcivillocation  lv2lgfemleg  liarda_chcatpct  liarda_isgenpct GEO7 ) (lcai_cai1, continuous ( 4 3)) if e(sample), vce(robust)
		estat proportion
		**outreg2 using Table2RR ,  replace word se label excel
		mediate (theta_mean ltheta_mean lpolity2 llnwdi_pop llnwdi_gdpcapcon2010 lintllocation lcivillocation  lv2lgfemleg  liarda_chcatpct  liarda_isgenpct GEO7) (lv2clsocgrp lpolity2 llnwdi_pop llnwdi_gdpcapcon2010 lintllocation lcivillocation  lv2lgfemleg  liarda_chcatpct  liarda_isgenpct GEO7 ) (lcai_cai1, continuous ( 4 2)) if e(sample), vce(robust)
		estat proportion 
		**outreg2 using Table2RR ,  append word se label excel
		*cai2 - from mean to 0
		mediate (theta_mean ltheta_mean lpolity2 llnwdi_pop llnwdi_gdpcapcon2010 lintllocation lcivillocation  lv2lgfemleg   liarda_chcatpct  liarda_isgenpct GEO7) (lv2clsocgrp  lpolity2 llnwdi_pop llnwdi_gdpcapcon2010 lintllocation lcivillocation lv2lgfemleg  liarda_chcatpct  liarda_isgenpct GEO7 ) (lcai_cai2, continuous ( .481 0)) if e(sample), vce(robust)
		estat proportion  
		**outreg2 using Table2RR ,  append word se label excel
		*cai2 - from 1 to 0
		mediate (theta_mean ltheta_mean lpolity2 llnwdi_pop llnwdi_gdpcapcon2010 lintllocation lcivillocation  lv2lgfemleg  liarda_chcatpct  liarda_isgenpct GEO7) (lv2clsocgrp  lpolity2 llnwdi_pop llnwdi_gdpcapcon2010 lintllocation lcivillocation  lv2lgfemleg  liarda_chcatpct  liarda_isgenpct GEO7 ) (lcai_cai2, continuous ( 1 0)) if e(sample), vce(robust)
		estat proportion
		**outreg2 using Table2RR ,  append word se label excel


		*Dynamic Simulations from the Manuscript
		clear 
		cd "C:\Users\murdie\Dropbox\ISA 2023 Naz Victor Abortion\Conditional Acceptance Stage 2024\Replication Data for A Ticking Time Bomb"

		use ReplicationDataset.dta, replace

		*First model
		reg theta_mean ltheta_mean lcai_cai1   lpolity2 llnwdi_pop llnwdi_gdpcapcon2010 lintllocation lcivillocation lv2lgfemleg  liarda_chcatpct  liarda_isgenpct GEO7, robust
		*get summary variables 
		sum ltheta_mean lcai_cai1 if e(sample), detail
		estsimp reg theta_mean ltheta_mean lcai_cai1   lpolity2 llnwdi_pop llnwdi_gdpcapcon2010 lintllocation lcivillocation lv2lgfemleg  liarda_chcatpct  liarda_isgenpct GEO7, robust sims (1000)

		* Figure 5a: The effects of drops in CAI scores (drop of 1 and drop of 2)
		dynsim, ldv(ltheta_mean) /*
		*/	scen1(ltheta_mean 0.44 lpolity2 mean llnwdi_pop mean llnwdi_gdpcapcon2010 mean lintllocation 0 lcivillocation 0  lv2lgfemleg  mean liarda_chcatpct mean liarda_isgenpct  mean  GEO7 0  lcai_cai1 4)  /*
		*/	scen2(ltheta_mean 0.44 lpolity2 mean llnwdi_pop mean llnwdi_gdpcapcon2010 mean lintllocation 0 lcivillocation 0  lv2lgfemleg  mean liarda_chcatpct mean liarda_isgenpct  mean  GEO7 0  lcai_cai1 3)  /*
		*/	scen3(ltheta_mean 0.44 lpolity2 mean llnwdi_pop mean llnwdi_gdpcapcon2010 mean lintllocation 0 lcivillocation 0  lv2lgfemleg  mean liarda_chcatpct mean liarda_isgenpct  mean  GEO7 0  lcai_cai1 2)  /*
		*/	n(8) sig(95) sav(CA11backsliding)


		preserve
			use CA11backsliding.dta, clear
			twoway (rcapsym lower_1 upper_1 t, msymbol(sh)) (rcapsym lower_2 upper_2 t, msymbol(x)) (rcapsym lower_3 upper_3 t, msymbol(s)), ytitle("Human Rights Protection Score", size(medlarge)) /*
			*/ legend(label(1 "Median Comparative Abortion Index #1 Score = 4") label(2 "Abortion Backsiding, Comparative Abortion Index #1 Score = 3") label(3 "Abortion Backsiding, Comparative Abortion Index #1 Score = 2") col(1) pos(6)) /*
			*/ xtitle("Year", size(medlarge)) xlabel(0(1)8)
		restore
		*graph save "Graph" "CAI1 Drops Fariss.gph", replace 


		*Figure 5b. : The effects of drops in CAI2 scores (highest mean lowest )
		use ReplicationDataset.dta, replace
		reg theta_mean ltheta_mean lcai_cai2   lpolity2 llnwdi_pop llnwdi_gdpcapcon2010 lintllocation lcivillocation lv2lgfemleg  liarda_chcatpct  liarda_isgenpct i.GEO7, robust
		sum ltheta_mean lcai_cai2 if e(sample), detail
		estsimp reg theta_mean ltheta_mean lcai_cai2   lpolity2 llnwdi_pop llnwdi_gdpcapcon2010 lintllocation lcivillocation lv2lgfemleg  liarda_chcatpct  liarda_isgenpct GEO7, robust
		dynsim, ldv(ltheta_mean) /*
		*/	scen1(ltheta_mean 0.44 lpolity2 mean llnwdi_pop mean llnwdi_gdpcapcon2010 mean lintllocation 0 lcivillocation 0  lv2lgfemleg  mean liarda_chcatpct mean liarda_isgenpct  mean  GEO7 0  lcai_cai2 1)  /*
		*/	scen2(ltheta_mean 0.44 lpolity2 mean llnwdi_pop mean llnwdi_gdpcapcon2010 mean lintllocation 0 lcivillocation 0  lv2lgfemleg  mean liarda_chcatpct mean liarda_isgenpct  mean  GEO7 0  lcai_cai2 .481)  /*
		*/	scen3(ltheta_mean 0.44 lpolity2 mean llnwdi_pop mean llnwdi_gdpcapcon2010 mean lintllocation 0 lcivillocation 0  lv2lgfemleg  mean liarda_chcatpct mean liarda_isgenpct  mean  GEO7 0  lcai_cai2 0)  /*
		*/	n(8) sig(95) sav(CAI2backsliding)


		preserve
			use CAI2backsliding.dta, clear
			twoway (rcapsym lower_1 upper_1 t, msymbol(sh)) (rcapsym lower_2 upper_2 t, msymbol(x)) (rcapsym lower_3 upper_3 t, msymbol(s)), ytitle("Human Rights Protection Score", size(medlarge)) /*
			*/ legend(label(1 "Highest Comparative Abortion Index #2 Score  = 1") label(2 "Abortion Backsiding, Mean Comparative Abortion Index #2 Score = 0.481") label(3 "Abortion Backsiding, Lowest Comparative Abortion Index #2 Score = 0") col(1) pos(6)) /*
			*/ xtitle("Year", size(medlarge)) xlabel(0(1)8)
		restore
		*graph save "Graph" "CAI2 Drops Fariss.gph", replace 

		*graph combine "CAI1 Drops Fariss.gph" "CAI2 Drops Fariss.gph", altshrink iscale(.7) 



		*Figure 6a: The effects of drops in CAI scores (drop of 1 and drop of 2) - v2clsocgrp 
		use ReplicationDataset.dta, replace
		reg v2clsocgrp lv2clsocgrp lcai_cai1   lpolity2 llnwdi_pop llnwdi_gdpcapcon2010 lintllocation lcivillocation lv2lgfemleg  liarda_chcatpct  liarda_isgenpct GEO7 , robust
		*get summary variables 
		sum lv2clsocgrp lcai_cai1 if e(sample), detail
		estsimp reg  v2clsocgrp lv2clsocgrp lcai_cai1   lpolity2 llnwdi_pop llnwdi_gdpcapcon2010 lintllocation lcivillocation lv2lgfemleg  liarda_chcatpct  liarda_isgenpct GEO7  , robust sims (1000)

		* Figure 5: The effects of drops in CAI scores (drop of 1 and drop of 2)
		dynsim, ldv( lv2clsocgrp) /*
		*/	scen1(lv2clsocgrp 1.020093 lpolity2 mean llnwdi_pop mean llnwdi_gdpcapcon2010 mean lintllocation 0 lcivillocation 0  lv2lgfemleg  mean liarda_chcatpct mean liarda_isgenpct  mean  GEO7 0  lcai_cai1 4)  /*
		*/	scen2(lv2clsocgrp 1.020093 lpolity2 mean llnwdi_pop mean llnwdi_gdpcapcon2010 mean lintllocation 0 lcivillocation 0  lv2lgfemleg  mean liarda_chcatpct mean liarda_isgenpct  mean  GEO7 0  lcai_cai1 3)  /*
		*/	scen3(lv2clsocgrp 1.020093 lpolity2 mean llnwdi_pop mean llnwdi_gdpcapcon2010 mean lintllocation 0 lcivillocation 0  lv2lgfemleg  mean liarda_chcatpct mean liarda_isgenpct  mean  GEO7 0  lcai_cai1 2)  /*
		*/	n(8) sig(95) sav(CA11backslidingv2clsocgrp)


		preserve
			use CA11backslidingv2clsocgrp.dta, clear
			twoway (rcapsym lower_1 upper_1 t, msymbol(sh)) (rcapsym lower_2 upper_2 t, msymbol(x)) (rcapsym lower_3 upper_3 t, msymbol(s)), ytitle("V-Dem: Social group equality in civil liberties", size(medlarge)) /*
			*/ legend(label(1 "Median Comparative Abortion Index #1 Score = 4") label(2 "Abortion Backsiding, Comparative Abortion Index #1 Score = 3") label(3 "Abortion Backsiding, Comparative Abortion Index #1 Score = 2") col(1) pos(6)) /*
			*/ xtitle("Year", size(medlarge)) xlabel(0(1)8)
		restore
		*graph save "Graph" "CAI1 Drops v2clsocgrp.gph", replace 


		*Figure 6b: The effects of drops in CAI2 scores (highest mean lowest ) - v2clsocgrp 
		use ReplicationDataset.dta, replace


		reg v2clsocgrp lv2clsocgrp   lcai_cai2   lpolity2 llnwdi_pop llnwdi_gdpcapcon2010 lintllocation lcivillocation lv2lgfemleg  liarda_chcatpct  liarda_isgenpct i.GEO7, robust
		sum lv2clsocgrp lcai_cai2 if e(sample), detail
		estsimp reg v2clsocgrp  lv2clsocgrp lcai_cai2   lpolity2 llnwdi_pop llnwdi_gdpcapcon2010 lintllocation lcivillocation lv2lgfemleg  liarda_chcatpct  liarda_isgenpct GEO7, robust
		dynsim, ldv(lv2clsocgrp ) /*
		*/	scen1(lv2clsocgrp 1.020093 lpolity2 mean llnwdi_pop mean llnwdi_gdpcapcon2010 mean lintllocation 0 lcivillocation 0  lv2lgfemleg  mean liarda_chcatpct mean liarda_isgenpct  mean  GEO7 0  lcai_cai2 1)  /*
		*/	scen2(lv2clsocgrp 1.020093 lpolity2 mean llnwdi_pop mean llnwdi_gdpcapcon2010 mean lintllocation 0 lcivillocation 0  lv2lgfemleg  mean liarda_chcatpct mean liarda_isgenpct  mean  GEO7 0  lcai_cai2 .481)  /*
		*/	scen3(lv2clsocgrp 1.020093 lpolity2 mean llnwdi_pop mean llnwdi_gdpcapcon2010 mean lintllocation 0 lcivillocation 0  lv2lgfemleg  mean liarda_chcatpct mean liarda_isgenpct  mean  GEO7 0  lcai_cai2 0)  /*
		*/	n(8) sig(95) sav(CAI2backslidingv2clsocgrp)


		preserve
			use CAI2backslidingv2clsocgrp, clear
			twoway (rcapsym lower_1 upper_1 t, msymbol(sh)) (rcapsym lower_2 upper_2 t, msymbol(x)) (rcapsym lower_3 upper_3 t, msymbol(s)), ytitle("V-Dem: Social group equality in civil liberties", size(medlarge)) /*
			*/ legend(label(1 "Highest Comparative Abortion Index #2 Score  = 1") label(2 "Abortion Backsiding, Mean Comparative Abortion Index #2 Score = 0.481") label(3 "Abortion Backsiding, Lowest Comparative Abortion Index #2 Score = 0") col(1) pos(6)) /*
			*/ xtitle("Year", size(medlarge)) xlabel(0(1)8)
		restore
		*graph save "Graph" "CAI2 Drops v2clsocgrp.gph", replace 

		*graph combine "CAI1 Drops v2clsocgrp.gph" "CAI2 Drops v2clsocgrp.gph", altshrink iscale(.7) 


*Analysis in the Online Appendix

		*Table 1: Full Model for the causal mediation model (also shown above)
				*treatment is going from median to 3 or median to 2
						use ReplicationDataset.dta, replace
		tsset ccode year 
				reg theta_mean  l.theta_mean  l.cai_cai1   l.polity2 l.lnwdi_pop l.lnwdi_gdpcapcon2010 l.intllocation l.civillocation l.v2lgfemleg  l.iarda_chcatpct  l.iarda_isgenpct i.GEO7, robust

				mediate (theta_mean ltheta_mean lpolity2 llnwdi_pop llnwdi_gdpcapcon2010 lintllocation lcivillocation lv2lgfemleg liarda_chcatpct  liarda_isgenpct GEO7) (lv2clsocgrp  lpolity2 llnwdi_pop llnwdi_gdpcapcon2010 lintllocation lcivillocation  lv2lgfemleg  liarda_chcatpct  liarda_isgenpct GEO7 ) (lcai_cai1, continuous ( 4 3)) if e(sample), vce(robust)
				estat proportion
				**outreg2 using Table2RR ,  replace word se label excel
				mediate (theta_mean ltheta_mean lpolity2 llnwdi_pop llnwdi_gdpcapcon2010 lintllocation lcivillocation  lv2lgfemleg  liarda_chcatpct  liarda_isgenpct GEO7) (lv2clsocgrp lpolity2 llnwdi_pop llnwdi_gdpcapcon2010 lintllocation lcivillocation  lv2lgfemleg  liarda_chcatpct  liarda_isgenpct GEO7 ) (lcai_cai1, continuous ( 4 2)) if e(sample), vce(robust)
				estat proportion 
				**outreg2 using Table2RR ,  append word se label excel
				*cai2 - from mean to 0
				mediate (theta_mean ltheta_mean lpolity2 llnwdi_pop llnwdi_gdpcapcon2010 lintllocation lcivillocation  lv2lgfemleg   liarda_chcatpct  liarda_isgenpct GEO7) (lv2clsocgrp  lpolity2 llnwdi_pop llnwdi_gdpcapcon2010 lintllocation lcivillocation lv2lgfemleg  liarda_chcatpct  liarda_isgenpct GEO7 ) (lcai_cai2, continuous ( .481 0)) if e(sample), vce(robust)
				estat proportion  
				**outreg2 using Table2RR ,  append word se label excel
				*cai2 - from 1 to 0
				mediate (theta_mean ltheta_mean lpolity2 llnwdi_pop llnwdi_gdpcapcon2010 lintllocation lcivillocation  lv2lgfemleg  liarda_chcatpct  liarda_isgenpct GEO7) (lv2clsocgrp  lpolity2 llnwdi_pop llnwdi_gdpcapcon2010 lintllocation lcivillocation  lv2lgfemleg  liarda_chcatpct  liarda_isgenpct GEO7 ) (lcai_cai2, continuous ( 1 0)) if e(sample), vce(robust)
				estat proportion
				**outreg2 using Table2RR ,  append word se label excel

		*Table 2: Fixed Effects
		reg theta_mean  l.theta_mean  l.cai_cai1   l.polity2 l.lnwdi_pop l.lnwdi_gdpcapcon2010 l.intllocation l.civillocation l.v2lgfemleg  l.iarda_chcatpct  l.iarda_isgenpct i.ccode, robust
		**outreg2 using Table11RR ,  replace word se label
		*Model 2: theta_mean and cai2
		reg theta_mean  l.theta_mean  l.cai_cai2   l.polity2 l.lnwdi_pop l.lnwdi_gdpcapcon2010 l.intllocation l.civillocation l.v2lgfemleg  l.iarda_chcatpct  l.iarda_isgenpct i.ccode, robust
		**outreg2 using Table11RR ,  append word se label
		*Model 3: social group cl & cai1
		reg v2clsocgrp l.v2clsocgrp   l.cai_cai1   l.polity2 l.lnwdi_pop l.lnwdi_gdpcapcon2010 l.intllocation l.civillocation l.v2lgfemleg  l.iarda_chcatpct  l.iarda_isgenpct i.ccode, robust
		**outreg2 using Table11RR ,  append word se label
		*Model 4: social group and cai2
		reg v2clsocgrp l.v2clsocgrp   l.cai_cai2   l.polity2 l.lnwdi_pop l.lnwdi_gdpcapcon2010 l.intllocation l.civillocation l.v2lgfemleg  l.iarda_chcatpct  l.iarda_isgenpct i.ccode, robust
		**outreg2 using Table11RR ,  append  word se label
		*Model 5: theta_mean and cai1, with social group cl included 
		reg theta_mean  l.theta_mean  l.v2clsocgrp  l.cai_cai1   l.polity2 l.lnwdi_pop l.lnwdi_gdpcapcon2010 l.intllocation l.civillocation l.v2lgfemleg  l.iarda_chcatpct  l.iarda_isgenpct i.ccode, robust
		**outreg2 using Table11RR ,  append word se label
		*Model 6: theta_mean and cai2
		reg theta_mean  l.theta_mean  l.v2clsocgrp  l.cai_cai2   l.polity2 l.lnwdi_pop l.lnwdi_gdpcapcon2010 l.intllocation l.civillocation l.v2lgfemleg  l.iarda_chcatpct  l.iarda_isgenpct i.ccode, robust
		**outreg2 using Table11RR ,  append word se label

		*Table 3: Random Effects:
		xtreg theta_mean  l.theta_mean  l.cai_cai1   l.polity2 l.lnwdi_pop l.lnwdi_gdpcapcon2010 l.intllocation l.civillocation l.v2lgfemleg  l.iarda_chcatpct  l.iarda_isgenpct i.GEO7, robust re
		**outreg2 using Table12RR ,  replace word se label
		*Model 2: theta_mean and cai2
		xtreg theta_mean  l.theta_mean  l.cai_cai2   l.polity2 l.lnwdi_pop l.lnwdi_gdpcapcon2010 l.intllocation l.civillocation l.v2lgfemleg  l.iarda_chcatpct  l.iarda_isgenpct i.GEO7, robust re
		**outreg2 using Table12RR ,  append word se label
		*Model 3: social group cl & cai1
		xtreg v2clsocgrp l.v2clsocgrp   l.cai_cai1   l.polity2 l.lnwdi_pop l.lnwdi_gdpcapcon2010 l.intllocation l.civillocation l.v2lgfemleg  l.iarda_chcatpct  l.iarda_isgenpct i.GEO7, robust re
		**outreg2 using Table12RR ,  append word se label
		*Model 4: social group and cai2
		xtreg v2clsocgrp l.v2clsocgrp   l.cai_cai2   l.polity2 l.lnwdi_pop l.lnwdi_gdpcapcon2010 l.intllocation l.civillocation l.v2lgfemleg  l.iarda_chcatpct  l.iarda_isgenpct i.GEO7, robust re 
		**outreg2 using Table12RR ,  append  word se label
		*Model 5: theta_mean and cai1, with social group cl included 
		xtreg theta_mean  l.theta_mean  l.v2clsocgrp  l.cai_cai1   l.polity2 l.lnwdi_pop l.lnwdi_gdpcapcon2010 l.intllocation l.civillocation l.v2lgfemleg  l.iarda_chcatpct  l.iarda_isgenpct i.GEO7, robust re 
		**outreg2 using Table12RR ,  append word se label
		*Model 6: theta_mean and cai2
		xtreg theta_mean  l.theta_mean  l.v2clsocgrp  l.cai_cai2   l.polity2 l.lnwdi_pop l.lnwdi_gdpcapcon2010 l.intllocation l.civillocation l.v2lgfemleg  l.iarda_chcatpct  l.iarda_isgenpct i.GEO7, robust re 
		**outreg2 using Table12RR ,  append word se label


		*Table 4: Yearly Fixed effects:
		reg theta_mean  l.theta_mean  l.cai_cai1   l.polity2 l.lnwdi_pop l.lnwdi_gdpcapcon2010 l.intllocation l.civillocation l.v2lgfemleg  l.iarda_chcatpct  l.iarda_isgenpct i.year, robust
		**outreg2 using Table13RR ,  replace word se label
		*Model 2: theta_mean and cai2
		reg theta_mean  l.theta_mean  l.cai_cai2   l.polity2 l.lnwdi_pop l.lnwdi_gdpcapcon2010 l.intllocation l.civillocation l.v2lgfemleg  l.iarda_chcatpct  l.iarda_isgenpct i.year, robust
		**outreg2 using Table13RR ,  append word se label
		*Model 3: social group cl & cai1
		reg v2clsocgrp l.v2clsocgrp   l.cai_cai1   l.polity2 l.lnwdi_pop l.lnwdi_gdpcapcon2010 l.intllocation l.civillocation l.v2lgfemleg  l.iarda_chcatpct  l.iarda_isgenpct i.year, robust
		**outreg2 using Table13RR ,  append word se label
		*Model 4: social group and cai2
		reg v2clsocgrp l.v2clsocgrp   l.cai_cai2   l.polity2 l.lnwdi_pop l.lnwdi_gdpcapcon2010 l.intllocation l.civillocation l.v2lgfemleg  l.iarda_chcatpct  l.iarda_isgenpct i.year, robust
		**outreg2 using Table13RR ,  append  word se label
		*Model 5: theta_mean and cai1, with social group cl included 
		reg theta_mean  l.theta_mean  l.v2clsocgrp  l.cai_cai1   l.polity2 l.lnwdi_pop l.lnwdi_gdpcapcon2010 l.intllocation l.civillocation l.v2lgfemleg  l.iarda_chcatpct  l.iarda_isgenpct i.year, robust
		**outreg2 using Table13RR ,  append word se label
		*Model 6: theta_mean and cai2
		reg theta_mean  l.theta_mean  l.v2clsocgrp  l.cai_cai2   l.polity2 l.lnwdi_pop l.lnwdi_gdpcapcon2010 l.intllocation l.civillocation l.v2lgfemleg  l.iarda_chcatpct  l.iarda_isgenpct i.year, robust
		**outreg2 using Table13RR ,  append word se label


		*Table 5: Two way fixed effects:
		reg theta_mean  l.theta_mean  l.cai_cai1   l.polity2 l.lnwdi_pop l.lnwdi_gdpcapcon2010 l.intllocation l.civillocation l.v2lgfemleg  l.iarda_chcatpct  l.iarda_isgenpct i.year i.ccode , robust
		**outreg2 using Table14RR ,  replace word se label
		*Model 2: theta_mean and cai2
		reg theta_mean  l.theta_mean  l.cai_cai2   l.polity2 l.lnwdi_pop l.lnwdi_gdpcapcon2010 l.intllocation l.civillocation l.v2lgfemleg  l.iarda_chcatpct  l.iarda_isgenpct i.year i.ccode , robust
		**outreg2 using Table14RR ,  append word se label
		*Model 3: social group cl & cai1
		reg v2clsocgrp l.v2clsocgrp   l.cai_cai1   l.polity2 l.lnwdi_pop l.lnwdi_gdpcapcon2010 l.intllocation l.civillocation l.v2lgfemleg  l.iarda_chcatpct  l.iarda_isgenpct i.year i.ccode , robust
		**outreg2 using Table14RR ,  append word se label
		*Model 4: social group and cai2
		reg v2clsocgrp l.v2clsocgrp   l.cai_cai2   l.polity2 l.lnwdi_pop l.lnwdi_gdpcapcon2010 l.intllocation l.civillocation l.v2lgfemleg  l.iarda_chcatpct  l.iarda_isgenpct i.year i.ccode , robust
		**outreg2 using Table14RR ,  append  word se label
		*Model 5: theta_mean and cai1, with social group cl included 
		reg theta_mean  l.theta_mean  l.v2clsocgrp  l.cai_cai1   l.polity2 l.lnwdi_pop l.lnwdi_gdpcapcon2010 l.intllocation l.civillocation l.v2lgfemleg  l.iarda_chcatpct  l.iarda_isgenpct i.year i.ccode , robust
		**outreg2 using Table14RR ,  append word se label
		*Model 6: theta_mean and cai2
		reg theta_mean  l.theta_mean  l.v2clsocgrp  l.cai_cai2   l.polity2 l.lnwdi_pop l.lnwdi_gdpcapcon2010 l.intllocation l.civillocation l.v2lgfemleg  l.iarda_chcatpct  l.iarda_isgenpct i.year i.ccode , robust
		**outreg2 using Table14RR ,  append word se label


		*Table 6: Change as DVAR:
		reg d.theta_mean ltheta_mean l.cai_cai1   l.polity2 l.lnwdi_pop l.lnwdi_gdpcapcon2010 l.intllocation l.civillocation l.v2lgfemleg  l.iarda_chcatpct  l.iarda_isgenpct i.GEO7, robust
		**outreg2 using Table15RR ,  replace word se label
		reg d.theta_mean ltheta_mean l.cai_cai2   l.polity2 l.lnwdi_pop l.lnwdi_gdpcapcon2010 l.intllocation l.civillocation l.v2lgfemleg  l.iarda_chcatpct  l.iarda_isgenpct i.GEO7, robust
		**outreg2 using Table15RR ,  append word se label
		*Model 3: social group cl & cai1
		reg d.v2clsocgrp l.v2clsocgrp   l.cai_cai1   l.polity2 l.lnwdi_pop l.lnwdi_gdpcapcon2010 l.intllocation l.civillocation l.v2lgfemleg  l.iarda_chcatpct  l.iarda_isgenpct  i.GEO7, robust
		**outreg2 using Table15RR ,  append word se label
		*Model 4: social group and cai2
		reg d.v2clsocgrp l.v2clsocgrp   l.cai_cai2   l.polity2 l.lnwdi_pop l.lnwdi_gdpcapcon2010 l.intllocation l.civillocation l.v2lgfemleg  l.iarda_chcatpct  l.iarda_isgenpct i.GEO7 , robust
		**outreg2 using Table15RR ,  append  word se label
		*Model 5: theta_mean and cai1, with social group cl included 
		reg d.theta_mean  l.theta_mean  l.v2clsocgrp  l.cai_cai1   l.polity2 l.lnwdi_pop l.lnwdi_gdpcapcon2010 l.intllocation l.civillocation l.v2lgfemleg  l.iarda_chcatpct  l.iarda_isgenpct i.GEO7 , robust
		**outreg2 using Table15RR ,  append word se label
		*Model 6: theta_mean and cai2
		reg d.theta_mean  l.theta_mean  l.v2clsocgrp  l.cai_cai2   l.polity2 l.lnwdi_pop l.lnwdi_gdpcapcon2010 l.intllocation l.civillocation l.v2lgfemleg  l.iarda_chcatpct  l.iarda_isgenpct i.GEO7 , robust
		**outreg2 using Table15RR ,  append word se label


		*Table 7: "Backsliding" as IVAR: 
		xtgee theta_mean l.cai_cai1  BackwardsAbortioncai1 l.polity2 l.lnwdi_pop l.lnwdi_gdpcapcon2010 l.intllocation l.civillocation l.v2lgfemleg  l.iarda_chcatpct  l.iarda_isgenpct i.GEO7, corr(ar1) force robust
		**outreg2 using Table16RR ,  replace word se label
		xtgee theta_mean l.cai_cai2  BackwardsAbortioncai2 l.polity2 l.lnwdi_pop l.lnwdi_gdpcapcon2010 l.intllocation l.civillocation l.v2lgfemleg  l.iarda_chcatpct  l.iarda_isgenpct i.GEO7 , corr(ar1) force robust
		**outreg2 using Table16RR ,  append word se label


		*Table 8: Change in CAI as key IVAR 
		xtgee theta_mean l.cai_cai1  d.cai_cai1 l.polity2 l.lnwdi_pop l.lnwdi_gdpcapcon2010 l.intllocation l.civillocation l.v2lgfemleg  l.iarda_chcatpct  l.iarda_isgenpct i.GEO7, corr(ar1) force robust
		**outreg2 using Table17RR ,  replace word se label
		xtgee theta_mean l.cai_cai2  d.cai_cai2 l.polity2 l.lnwdi_pop l.lnwdi_gdpcapcon2010 l.intllocation l.civillocation l.v2lgfemleg  l.iarda_chcatpct  l.iarda_isgenpct i.GEO7, corr(ar1) force robust
		**outreg2 using Table17RR ,  append word se label
		xtgee physint l.cai_cai1  d.cai_cai1 l.polity2 l.lnwdi_pop l.lnwdi_gdpcapcon2010 l.intllocation l.civillocation l.v2lgfemleg  l.iarda_chcatpct  l.iarda_isgenpct i.GEO7, corr(ar1) force robust
		**outreg2 using Table17RR ,  append word se label
		xtgee physint l.cai_cai2  d.cai_cai2 l.polity2 l.lnwdi_pop l.lnwdi_gdpcapcon2010 l.intllocation l.civillocation l.v2lgfemleg  l.iarda_chcatpct  l.iarda_isgenpct i.GEO7, corr(ar1) force robust
		**outreg2 using Table17RR ,  append word se label


		*Table 9: Granger causality
		reg theta_mean  l.theta_mean  l.cai_cai1   l.polity2 l.lnwdi_pop l.lnwdi_gdpcapcon2010 l.intllocation l.civillocation l.v2lgfemleg  l.iarda_chcatpct  l.iarda_isgenpct i.GEO7, robust
		regress cai_cai2 l.cai_cai2 theta_mean l.theta_mean if e(sample), cluster(ccode)
		testparm theta_mean l.theta_mean
		regress theta_mean l.theta_mean cai_cai2 l.cai_cai2 if e(sample), cluster(ccode)
		testparm cai_cai2 l.cai_cai2 
		regress cai_cai1 l.cai_cai1 theta_mean l.theta_mean if e(sample), cluster(ccode)
		testparm theta_mean l.theta_mean
		regress theta_mean l.theta_mean cai_cai1 l.cai_cai1 if e(sample), cluster(ccode)
		testparm cai_cai1 l.cai_cai1 

		*Table 10: Panel VAR
		reg theta_mean  l.theta_mean  l.cai_cai1   l.polity2 l.lnwdi_pop l.lnwdi_gdpcapcon2010 l.intllocation l.civillocation l.v2lgfemleg  l.iarda_chcatpct  l.iarda_isgenpct i.GEO7, robust
		pvar theta_mean cai_cai2 if e(sample),  lags(2)
		**outreg2 using PanelTable ,  replace word se label
		pvar theta_mean cai_cai1 if e(sample), lags(2)
		**outreg2 using PanelTable ,  append word se label

		*Table 11: Decreases and Timing 
		count if BackwardsAbortioncai1 == 1 & D.F.physint<0
		*6
		count if BackwardsAbortioncai1 == 1 & D.physint<0
		*10
		count if BackwardsAbortioncai1 == 1 & D.L.physint<0
		*3
		count if BackwardsAbortioncai2 == 1 & D.F.physint<0
		*102
		count if BackwardsAbortioncai2 == 1 & D.physint<0
		*99
		count if BackwardsAbortioncai2 == 1 & D.L.physint<0
		*64
		count if BackwardsAbortioncai1 == 1 & D.F.theta_mean<0
		*9
		count if BackwardsAbortioncai1 == 1 & D.theta_mean<0
		*12
		count if BackwardsAbortioncai1 == 1 & D.L.theta_mean<0
		*8
		count if BackwardsAbortioncai2 == 1 & D.F.theta_mean<0
		*153
		count if BackwardsAbortioncai2 == 1 & D.theta_mean<0
		*133
		count if BackwardsAbortioncai2 == 1 & D.L.theta_mean<0
		*129


		*Table 12: O'Brien Statistics 
		*In sample and out of sample predictions 
		****Trying accuracy, recall, precision 

		clear 
		cd "C:\Users\murdie\Dropbox\ISA 2023 Naz Victor Abortion\Conditional Acceptance Stage 2024\Replication Data for A Ticking Time Bomb"
		use ReplicationDataset.dta, replace
		tsset ccode year 
		*Basic model
		reg theta_mean  l.theta_mean  l.cai_cai1   l.polity2 l.lnwdi_pop l.lnwdi_gdpcapcon2010 l.intllocation l.civillocation l.v2lgfemleg  l.iarda_chcatpct  l.iarda_isgenpct i.GEO7, robust
		predict xb if e(sample) 
		gen residual=theta_mean-xb if e(sample)
		sum residual
		*3413
		gen analysispositive = 1 if residual> 0    & residual!=. & e(sample) 
		tab analysispositive 
		*1736
		by ccode: gen HRworseyear1=0 if  e(sample) & theta_mean[_n+1]!=. &   year<2015
		by ccode: replace HRworseyear1=1 if FD.theta_mean<  0  & e(sample) & theta_mean[_n+1]!=. &   year<2015
		by ccode: gen HRworseyear2=0 if e(sample) & theta_mean[_n+2]!=. & theta_mean[_n+1]!=.   &  year<2014
		by ccode: replace HRworseyear2=1 if (theta_mean[_n+2]-theta_mean)< 0  & e(sample) & theta_mean[_n+2]!=. & theta_mean[_n+1]!=.   &  year<2014
		by ccode: gen HRworseyear3=0 if e(sample) & theta_mean[_n+3]!=. & theta_mean[_n+2]!=. & theta_mean[_n+1]!=.   &  year<2013
		by ccode: replace HRworseyear3=1 if (theta_mean[_n+3]-theta_mean)<  0  & e(sample) & theta_mean[_n+3]!=. & theta_mean[_n+2]!=. & theta_mean[_n+1]!=.   &  year<2013
		by ccode: gen HRworseyear4=0 if e(sample) & theta_mean[_n+4]!=. & theta_mean[_n+3]!=. & theta_mean[_n+2]!=. & theta_mean[_n+1]!=.   &  year<2012
		by ccode: replace HRworseyear4=1 if (theta_mean[_n+4]-theta_mean)< 0   & e(sample) & theta_mean[_n+4]!=. & theta_mean[_n+3]!=. & theta_mean[_n+2]!=. & theta_mean[_n+1]!=.   &  year<2012
		by ccode: gen HRworseyear5=0 if e(sample) & theta_mean[_n+5]!=. & theta_mean[_n+4]!=. & theta_mean[_n+3]!=. & theta_mean[_n+2]!=. & theta_mean[_n+1]!=. &  year<2011
		by ccode: replace HRworseyear5=1 if (theta_mean[_n+5]-theta_mean)<  0  & e(sample) & theta_mean[_n+5]!=. & theta_mean[_n+4]!=. & theta_mean[_n+3]!=. & theta_mean[_n+2]!=. & theta_mean[_n+1]!=. &  year<2011
		count if analysis==1 & (HRworseyear1==1 | HRworseyear2==1| HRworseyear3==1 | HRworseyear4==1| HRworseyear5==1) 
		*695
		count if (HRworseyear1==1 | HRworseyear2==1| HRworseyear3==1 | HRworseyear4==1| HRworseyear5==1) & e(sample)
		*1742
		tab analysispositive 
		gen analysisnegative = 1 if residual< 0    & residual!=. & e(sample) 
		tab analysisnegative 
		*1677
		by ccode: gen HRbetteryear1=0 if  e(sample) & theta_mean[_n+1]!=. &   year<2015
		by ccode: replace HRbetteryear1=1 if FD.theta_mean>  0  & e(sample) & theta_mean[_n+1]!=. &   year<2015
		by ccode: gen HRbetteryear2=0 if e(sample) & theta_mean[_n+2]!=. & theta_mean[_n+1]!=.   &  year<2014
		by ccode: replace HRbetteryear2=1 if (theta_mean[_n+2]-theta_mean)> 0  & e(sample) & theta_mean[_n+2]!=. & theta_mean[_n+1]!=.   &  year<2014
		by ccode: gen HRbetteryear3=0 if e(sample) & theta_mean[_n+3]!=. & theta_mean[_n+2]!=. & theta_mean[_n+1]!=.   &  year<2013
		by ccode: replace HRbetteryear3=1 if (theta_mean[_n+3]-theta_mean)>  0  & e(sample) & theta_mean[_n+3]!=. & theta_mean[_n+2]!=. & theta_mean[_n+1]!=.   &  year<2013
		by ccode: gen HRbetteryear4=0 if e(sample) & theta_mean[_n+4]!=. & theta_mean[_n+3]!=. & theta_mean[_n+2]!=. & theta_mean[_n+1]!=.   &  year<2012
		by ccode: replace HRbetteryear4=1 if (theta_mean[_n+4]-theta_mean)> 0   & e(sample) & theta_mean[_n+4]!=. & theta_mean[_n+3]!=. & theta_mean[_n+2]!=. & theta_mean[_n+1]!=.   &  year<2012
		by ccode: gen HRbetteryear5=0 if e(sample) & theta_mean[_n+5]!=. & theta_mean[_n+4]!=. & theta_mean[_n+3]!=. & theta_mean[_n+2]!=. & theta_mean[_n+1]!=. &  year<2011
		by ccode: replace HRbetteryear5=1 if (theta_mean[_n+5]-theta_mean)> 0  & e(sample) & theta_mean[_n+5]!=. & theta_mean[_n+4]!=. & theta_mean[_n+3]!=. & theta_mean[_n+2]!=. & theta_mean[_n+1]!=. &  year<2011
		count if analysisnegative ==1 & (HRbetteryear1==1 | HRbetteryear2==1| HRbetteryear3==1 | HRbetteryear4==1| HRbetteryear5==1) 
		*1370
		count if (HRbetteryear1==1 | HRbetteryear2==1| HRbetteryear3==1 | HRbetteryear4==1| HRbetteryear5==1) & e(sample)
		*2389

		*so:
		*accuracy = (695+1370)/(1736+1677) = .60503955
		*recall = 695/1742 = .3989667
		*precison = 695/1736 = .40034562



		*Now, without CAI 
		clear 
		cd "C:\Users\murdie\Dropbox\ISA 2023 Naz Victor Abortion\Conditional Acceptance Stage 2024\Replication Data for A Ticking Time Bomb"
		use ReplicationDataset.dta, replace
		tsset ccode year 
		*Basic model
		reg theta_mean  l.theta_mean  l.cai_cai1   l.polity2 l.lnwdi_pop l.lnwdi_gdpcapcon2010 l.intllocation l.civillocation l.v2lgfemleg  l.iarda_chcatpct  l.iarda_isgenpct i.GEO7, robust
		*without CAI
		reg theta_mean  l.theta_mean    l.polity2 l.lnwdi_pop l.lnwdi_gdpcapcon2010 l.intllocation l.civillocation l.v2lgfemleg  l.iarda_chcatpct  l.iarda_isgenpct i.GEO7 if e(sample), robust
		predict xb if e(sample) 
		gen residual=theta_mean-xb if e(sample)
		sum residual
		*3413
		gen analysispositive = 1 if residual> 0    & residual!=. & e(sample) 
		tab analysispositive 
		*1741
		by ccode: gen HRworseyear1=0 if  e(sample) & theta_mean[_n+1]!=. &   year<2015
		by ccode: replace HRworseyear1=1 if FD.theta_mean<  0  & e(sample) & theta_mean[_n+1]!=. &   year<2015
		by ccode: gen HRworseyear2=0 if e(sample) & theta_mean[_n+2]!=. & theta_mean[_n+1]!=.   &  year<2014
		by ccode: replace HRworseyear2=1 if (theta_mean[_n+2]-theta_mean)< 0  & e(sample) & theta_mean[_n+2]!=. & theta_mean[_n+1]!=.   &  year<2014
		by ccode: gen HRworseyear3=0 if e(sample) & theta_mean[_n+3]!=. & theta_mean[_n+2]!=. & theta_mean[_n+1]!=.   &  year<2013
		by ccode: replace HRworseyear3=1 if (theta_mean[_n+3]-theta_mean)<  0  & e(sample) & theta_mean[_n+3]!=. & theta_mean[_n+2]!=. & theta_mean[_n+1]!=.   &  year<2013
		by ccode: gen HRworseyear4=0 if e(sample) & theta_mean[_n+4]!=. & theta_mean[_n+3]!=. & theta_mean[_n+2]!=. & theta_mean[_n+1]!=.   &  year<2012
		by ccode: replace HRworseyear4=1 if (theta_mean[_n+4]-theta_mean)< 0   & e(sample) & theta_mean[_n+4]!=. & theta_mean[_n+3]!=. & theta_mean[_n+2]!=. & theta_mean[_n+1]!=.   &  year<2012
		by ccode: gen HRworseyear5=0 if e(sample) & theta_mean[_n+5]!=. & theta_mean[_n+4]!=. & theta_mean[_n+3]!=. & theta_mean[_n+2]!=. & theta_mean[_n+1]!=. &  year<2011
		by ccode: replace HRworseyear5=1 if (theta_mean[_n+5]-theta_mean)<  0  & e(sample) & theta_mean[_n+5]!=. & theta_mean[_n+4]!=. & theta_mean[_n+3]!=. & theta_mean[_n+2]!=. & theta_mean[_n+1]!=. &  year<2011
		count if analysis==1 & (HRworseyear1==1 | HRworseyear2==1| HRworseyear3==1 | HRworseyear4==1| HRworseyear5==1) 
		*703
		count if (HRworseyear1==1 | HRworseyear2==1| HRworseyear3==1 | HRworseyear4==1| HRworseyear5==1) & e(sample)
		*1742
		tab analysispositive 
		gen analysisnegative = 1 if residual< 0    & residual!=. & e(sample) 
		tab analysisnegative 
		*1672
		by ccode: gen HRbetteryear1=0 if  e(sample) & theta_mean[_n+1]!=. &   year<2015
		by ccode: replace HRbetteryear1=1 if FD.theta_mean>  0  & e(sample) & theta_mean[_n+1]!=. &   year<2015
		by ccode: gen HRbetteryear2=0 if e(sample) & theta_mean[_n+2]!=. & theta_mean[_n+1]!=.   &  year<2014
		by ccode: replace HRbetteryear2=1 if (theta_mean[_n+2]-theta_mean)> 0  & e(sample) & theta_mean[_n+2]!=. & theta_mean[_n+1]!=.   &  year<2014
		by ccode: gen HRbetteryear3=0 if e(sample) & theta_mean[_n+3]!=. & theta_mean[_n+2]!=. & theta_mean[_n+1]!=.   &  year<2013
		by ccode: replace HRbetteryear3=1 if (theta_mean[_n+3]-theta_mean)>  0  & e(sample) & theta_mean[_n+3]!=. & theta_mean[_n+2]!=. & theta_mean[_n+1]!=.   &  year<2013
		by ccode: gen HRbetteryear4=0 if e(sample) & theta_mean[_n+4]!=. & theta_mean[_n+3]!=. & theta_mean[_n+2]!=. & theta_mean[_n+1]!=.   &  year<2012
		by ccode: replace HRbetteryear4=1 if (theta_mean[_n+4]-theta_mean)> 0   & e(sample) & theta_mean[_n+4]!=. & theta_mean[_n+3]!=. & theta_mean[_n+2]!=. & theta_mean[_n+1]!=.   &  year<2012
		by ccode: gen HRbetteryear5=0 if e(sample) & theta_mean[_n+5]!=. & theta_mean[_n+4]!=. & theta_mean[_n+3]!=. & theta_mean[_n+2]!=. & theta_mean[_n+1]!=. &  year<2011
		by ccode: replace HRbetteryear5=1 if (theta_mean[_n+5]-theta_mean)> 0  & e(sample) & theta_mean[_n+5]!=. & theta_mean[_n+4]!=. & theta_mean[_n+3]!=. & theta_mean[_n+2]!=. & theta_mean[_n+1]!=. &  year<2011
		count if analysisnegative==1 & (HRbetteryear1==1 | HRbetteryear2==1| HRbetteryear3==1 | HRbetteryear4==1| HRbetteryear5==1) 
		*1022
		count if (HRbetteryear1==1 | HRbetteryear2==1| HRbetteryear3==1 | HRbetteryear4==1| HRbetteryear5==1) & e(sample)
		*2389
		*so:
		*accuracy = (703+1022)/(1741+1672) = .50542045
		*recall = 703/1742 = .40355913
		*precison = 703/1741 = .40379092


		*Out of sample
		*use a model through 2011 to predict things in  2012 2013 2014 2015 2016
		****Trying accuracy, recall, precision 
		clear 
		cd "C:\Users\murdie\Dropbox\ISA 2023 Naz Victor Abortion\Conditional Acceptance Stage 2024\Replication Data for A Ticking Time Bomb"
		use ReplicationDataset.dta, replace
		tsset ccode year 
		*Basic model
		reg theta_mean  l.theta_mean  l.cai_cai1   l.polity2 l.lnwdi_pop l.lnwdi_gdpcapcon2010 l.intllocation l.civillocation l.v2lgfemleg  l.iarda_chcatpct  l.iarda_isgenpct i.GEO7 if year<2012, robust
		predict xb if e(sample) 
		gen residual=theta_mean-xb if e(sample) 
		sum residual
		gen analysispositive = 1 if residual> 0    & residual!=. & e(sample) & year==2011
		tab analysispositive 
		*82
		by ccode: gen HRworseyear1=0 if  e(sample) & theta_mean[_n+1]!=. &   year<2015
		by ccode: replace HRworseyear1=1 if FD.theta_mean<  0  & e(sample) & theta_mean[_n+1]!=. &   year<2015
		by ccode: gen HRworseyear2=0 if e(sample) & theta_mean[_n+2]!=. & theta_mean[_n+1]!=.   &  year<2014
		by ccode: replace HRworseyear2=1 if (theta_mean[_n+2]-theta_mean)< 0  & e(sample) & theta_mean[_n+2]!=. & theta_mean[_n+1]!=.   &  year<2014
		by ccode: gen HRworseyear3=0 if e(sample) & theta_mean[_n+3]!=. & theta_mean[_n+2]!=. & theta_mean[_n+1]!=.   &  year<2013
		by ccode: replace HRworseyear3=1 if (theta_mean[_n+3]-theta_mean)<  0  & e(sample) & theta_mean[_n+3]!=. & theta_mean[_n+2]!=. & theta_mean[_n+1]!=.   &  year<2013
		by ccode: gen HRworseyear4=0 if e(sample) & theta_mean[_n+4]!=. & theta_mean[_n+3]!=. & theta_mean[_n+2]!=. & theta_mean[_n+1]!=.   &  year<2012
		by ccode: replace HRworseyear4=1 if (theta_mean[_n+4]-theta_mean)< 0   & e(sample) & theta_mean[_n+4]!=. & theta_mean[_n+3]!=. & theta_mean[_n+2]!=. & theta_mean[_n+1]!=.   &  year<2012
		by ccode: gen HRworseyear5=0 if e(sample) & theta_mean[_n+5]!=. & theta_mean[_n+4]!=. & theta_mean[_n+3]!=. & theta_mean[_n+2]!=. & theta_mean[_n+1]!=. &  year<2011
		by ccode: replace HRworseyear5=1 if (theta_mean[_n+5]-theta_mean)<  0  & e(sample) & theta_mean[_n+5]!=. & theta_mean[_n+4]!=. & theta_mean[_n+3]!=. & theta_mean[_n+2]!=. & theta_mean[_n+1]!=. &  year<2011
		count if analysis==1 & (HRworseyear1==1 | HRworseyear2==1| HRworseyear3==1 | HRworseyear4==1| HRworseyear5==1) & year ==2011
		*24
		count if (HRworseyear1==1 | HRworseyear2==1| HRworseyear3==1 | HRworseyear4==1| HRworseyear5==1) & e(sample)& year==2011
		*60
		tab analysispositive 
		gen analysisnegative = 1 if residual< 0    & residual!=. & e(sample) & year==2011
		tab analysisnegative 
		*67
		by ccode: gen HRbetteryear1=0 if  e(sample) & theta_mean[_n+1]!=. &   year<2015
		by ccode: replace HRbetteryear1=1 if FD.theta_mean>  0  & e(sample) & theta_mean[_n+1]!=. &   year<2015
		by ccode: gen HRbetteryear2=0 if e(sample) & theta_mean[_n+2]!=. & theta_mean[_n+1]!=.   &  year<2014
		by ccode: replace HRbetteryear2=1 if (theta_mean[_n+2]-theta_mean)> 0  & e(sample) & theta_mean[_n+2]!=. & theta_mean[_n+1]!=.   &  year<2014
		by ccode: gen HRbetteryear3=0 if e(sample) & theta_mean[_n+3]!=. & theta_mean[_n+2]!=. & theta_mean[_n+1]!=.   &  year<2013
		by ccode: replace HRbetteryear3=1 if (theta_mean[_n+3]-theta_mean)>  0  & e(sample) & theta_mean[_n+3]!=. & theta_mean[_n+2]!=. & theta_mean[_n+1]!=.   &  year<2013
		by ccode: gen HRbetteryear4=0 if e(sample) & theta_mean[_n+4]!=. & theta_mean[_n+3]!=. & theta_mean[_n+2]!=. & theta_mean[_n+1]!=.   &  year<2012
		by ccode: replace HRbetteryear4=1 if (theta_mean[_n+4]-theta_mean)> 0   & e(sample) & theta_mean[_n+4]!=. & theta_mean[_n+3]!=. & theta_mean[_n+2]!=. & theta_mean[_n+1]!=.   &  year<2012
		by ccode: gen HRbetteryear5=0 if e(sample) & theta_mean[_n+5]!=. & theta_mean[_n+4]!=. & theta_mean[_n+3]!=. & theta_mean[_n+2]!=. & theta_mean[_n+1]!=. &  year<2011
		by ccode: replace HRbetteryear5=1 if (theta_mean[_n+5]-theta_mean)> 0  & e(sample) & theta_mean[_n+5]!=. & theta_mean[_n+4]!=. & theta_mean[_n+3]!=. & theta_mean[_n+2]!=. & theta_mean[_n+1]!=. &  year<2011
		count if analysisnegative ==1 & (HRbetteryear1==1 | HRbetteryear2==1| HRbetteryear3==1 | HRbetteryear4==1| HRbetteryear5==1) & year==2011
		*44
		count if (HRbetteryear1==1 | HRbetteryear2==1| HRbetteryear3==1 | HRbetteryear4==1| HRbetteryear5==1) & e(sample) & year==2011
		*118
		*so:
		*accuracy = (24+44)/(82 +67) =.45637584
		*recall = (24/60) = .4
		*precison = (24/82) = .29268293

		*great, now without CAI 
		clear 
		cd "C:\Users\murdie\Dropbox\ISA 2023 Naz Victor Abortion\Conditional Acceptance Stage 2024\Replication Data for A Ticking Time Bomb"
		use ReplicationDataset.dta, replace
		tsset ccode year 
		*Basic model
		reg theta_mean  l.theta_mean  l.cai_cai1   l.polity2 l.lnwdi_pop l.lnwdi_gdpcapcon2010 l.intllocation l.civillocation l.v2lgfemleg  l.iarda_chcatpct  l.iarda_isgenpct i.GEO7 if year<2012, robust
		reg theta_mean  l.theta_mean    l.polity2 l.lnwdi_pop l.lnwdi_gdpcapcon2010 l.intllocation l.civillocation l.v2lgfemleg  l.iarda_chcatpct  l.iarda_isgenpct i.GEO7 if year<2012 & e(sample), robust
		predict xb if e(sample) 
		gen residual=theta_mean-xb if e(sample) 
		sum residual
		gen analysispositive = 1 if residual> 0    & residual!=. & e(sample) & year==2011
		tab analysispositive 
		*78
		by ccode: gen HRworseyear1=0 if  e(sample) & theta_mean[_n+1]!=. &   year<2015
		by ccode: replace HRworseyear1=1 if FD.theta_mean<  0  & e(sample) & theta_mean[_n+1]!=. &   year<2015
		by ccode: gen HRworseyear2=0 if e(sample) & theta_mean[_n+2]!=. & theta_mean[_n+1]!=.   &  year<2014
		by ccode: replace HRworseyear2=1 if (theta_mean[_n+2]-theta_mean)< 0  & e(sample) & theta_mean[_n+2]!=. & theta_mean[_n+1]!=.   &  year<2014
		by ccode: gen HRworseyear3=0 if e(sample) & theta_mean[_n+3]!=. & theta_mean[_n+2]!=. & theta_mean[_n+1]!=.   &  year<2013
		by ccode: replace HRworseyear3=1 if (theta_mean[_n+3]-theta_mean)<  0  & e(sample) & theta_mean[_n+3]!=. & theta_mean[_n+2]!=. & theta_mean[_n+1]!=.   &  year<2013
		by ccode: gen HRworseyear4=0 if e(sample) & theta_mean[_n+4]!=. & theta_mean[_n+3]!=. & theta_mean[_n+2]!=. & theta_mean[_n+1]!=.   &  year<2012
		by ccode: replace HRworseyear4=1 if (theta_mean[_n+4]-theta_mean)< 0   & e(sample) & theta_mean[_n+4]!=. & theta_mean[_n+3]!=. & theta_mean[_n+2]!=. & theta_mean[_n+1]!=.   &  year<2012
		by ccode: gen HRworseyear5=0 if e(sample) & theta_mean[_n+5]!=. & theta_mean[_n+4]!=. & theta_mean[_n+3]!=. & theta_mean[_n+2]!=. & theta_mean[_n+1]!=. &  year<2011
		by ccode: replace HRworseyear5=1 if (theta_mean[_n+5]-theta_mean)<  0  & e(sample) & theta_mean[_n+5]!=. & theta_mean[_n+4]!=. & theta_mean[_n+3]!=. & theta_mean[_n+2]!=. & theta_mean[_n+1]!=. &  year<2011
		count if analysis==1 & (HRworseyear1==1 | HRworseyear2==1| HRworseyear3==1 | HRworseyear4==1| HRworseyear5==1) & year ==2011
		*21
		count if (HRworseyear1==1 | HRworseyear2==1| HRworseyear3==1 | HRworseyear4==1| HRworseyear5==1) & e(sample)& year==2011
		*60
		tab analysispositive 
		gen analysisnegative = 1 if residual< 0    & residual!=. & e(sample) & year==2011
		tab analysisnegative 
		*71
		by ccode: gen HRbetteryear1=0 if  e(sample) & theta_mean[_n+1]!=. &   year<2015
		by ccode: replace HRbetteryear1=1 if FD.theta_mean>  0  & e(sample) & theta_mean[_n+1]!=. &   year<2015
		by ccode: gen HRbetteryear2=0 if e(sample) & theta_mean[_n+2]!=. & theta_mean[_n+1]!=.   &  year<2014
		by ccode: replace HRbetteryear2=1 if (theta_mean[_n+2]-theta_mean)> 0  & e(sample) & theta_mean[_n+2]!=. & theta_mean[_n+1]!=.   &  year<2014
		by ccode: gen HRbetteryear3=0 if e(sample) & theta_mean[_n+3]!=. & theta_mean[_n+2]!=. & theta_mean[_n+1]!=.   &  year<2013
		by ccode: replace HRbetteryear3=1 if (theta_mean[_n+3]-theta_mean)>  0  & e(sample) & theta_mean[_n+3]!=. & theta_mean[_n+2]!=. & theta_mean[_n+1]!=.   &  year<2013
		by ccode: gen HRbetteryear4=0 if e(sample) & theta_mean[_n+4]!=. & theta_mean[_n+3]!=. & theta_mean[_n+2]!=. & theta_mean[_n+1]!=.   &  year<2012
		by ccode: replace HRbetteryear4=1 if (theta_mean[_n+4]-theta_mean)> 0   & e(sample) & theta_mean[_n+4]!=. & theta_mean[_n+3]!=. & theta_mean[_n+2]!=. & theta_mean[_n+1]!=.   &  year<2012
		by ccode: gen HRbetteryear5=0 if e(sample) & theta_mean[_n+5]!=. & theta_mean[_n+4]!=. & theta_mean[_n+3]!=. & theta_mean[_n+2]!=. & theta_mean[_n+1]!=. &  year<2011
		by ccode: replace HRbetteryear5=1 if (theta_mean[_n+5]-theta_mean)> 0  & e(sample) & theta_mean[_n+5]!=. & theta_mean[_n+4]!=. & theta_mean[_n+3]!=. & theta_mean[_n+2]!=. & theta_mean[_n+1]!=. &  year<2011
		count if analysisnegative ==1 & (HRbetteryear1==1 | HRbetteryear2==1| HRbetteryear3==1 | HRbetteryear4==1| HRbetteryear5==1) & year==2011
		*46
		count if (HRbetteryear1==1 | HRbetteryear2==1| HRbetteryear3==1 | HRbetteryear4==1| HRbetteryear5==1) & e(sample) & year==2011
		*118

		*so:
		*accuracy = (21+46)/(78 +71) =.44966443
		*recall = (21/60) = .35
		*precison = (21/78) = .26923077


		*Same thing for CAI #2
		*In-Sample
		use ReplicationDataset.dta, replace
		tsset ccode year 
		*Basic model
		reg theta_mean  l.theta_mean  l.cai_cai2   l.polity2 l.lnwdi_pop l.lnwdi_gdpcapcon2010 l.intllocation l.civillocation l.v2lgfemleg  l.iarda_chcatpct  l.iarda_isgenpct i.GEO7, robust
		predict xb if e(sample) 
		gen residual=theta_mean-xb if e(sample)
		sum residual
		*3413
		gen analysispositive = 1 if residual> 0    & residual!=. & e(sample) 
		tab analysispositive 
		*1,732  
		by ccode: gen HRworseyear1=0 if  e(sample) & theta_mean[_n+1]!=. &   year<2015
		by ccode: replace HRworseyear1=1 if FD.theta_mean<  0  & e(sample) & theta_mean[_n+1]!=. &   year<2015
		by ccode: gen HRworseyear2=0 if e(sample) & theta_mean[_n+2]!=. & theta_mean[_n+1]!=.   &  year<2014
		by ccode: replace HRworseyear2=1 if (theta_mean[_n+2]-theta_mean)< 0  & e(sample) & theta_mean[_n+2]!=. & theta_mean[_n+1]!=.   &  year<2014
		by ccode: gen HRworseyear3=0 if e(sample) & theta_mean[_n+3]!=. & theta_mean[_n+2]!=. & theta_mean[_n+1]!=.   &  year<2013
		by ccode: replace HRworseyear3=1 if (theta_mean[_n+3]-theta_mean)<  0  & e(sample) & theta_mean[_n+3]!=. & theta_mean[_n+2]!=. & theta_mean[_n+1]!=.   &  year<2013
		by ccode: gen HRworseyear4=0 if e(sample) & theta_mean[_n+4]!=. & theta_mean[_n+3]!=. & theta_mean[_n+2]!=. & theta_mean[_n+1]!=.   &  year<2012
		by ccode: replace HRworseyear4=1 if (theta_mean[_n+4]-theta_mean)< 0   & e(sample) & theta_mean[_n+4]!=. & theta_mean[_n+3]!=. & theta_mean[_n+2]!=. & theta_mean[_n+1]!=.   &  year<2012
		by ccode: gen HRworseyear5=0 if e(sample) & theta_mean[_n+5]!=. & theta_mean[_n+4]!=. & theta_mean[_n+3]!=. & theta_mean[_n+2]!=. & theta_mean[_n+1]!=. &  year<2011
		by ccode: replace HRworseyear5=1 if (theta_mean[_n+5]-theta_mean)<  0  & e(sample) & theta_mean[_n+5]!=. & theta_mean[_n+4]!=. & theta_mean[_n+3]!=. & theta_mean[_n+2]!=. & theta_mean[_n+1]!=. &  year<2011
		count if analysis==1 & (HRworseyear1==1 | HRworseyear2==1| HRworseyear3==1 | HRworseyear4==1| HRworseyear5==1) 
		*691
		count if (HRworseyear1==1 | HRworseyear2==1| HRworseyear3==1 | HRworseyear4==1| HRworseyear5==1) & e(sample)
		*1742
		tab analysispositive 
		gen analysisnegative = 1 if residual< 0    & residual!=. & e(sample) 
		tab analysisnegative 
		*1681
		by ccode: gen HRbetteryear1=0 if  e(sample) & theta_mean[_n+1]!=. &   year<2015
		by ccode: replace HRbetteryear1=1 if FD.theta_mean>  0  & e(sample) & theta_mean[_n+1]!=. &   year<2015
		by ccode: gen HRbetteryear2=0 if e(sample) & theta_mean[_n+2]!=. & theta_mean[_n+1]!=.   &  year<2014
		by ccode: replace HRbetteryear2=1 if (theta_mean[_n+2]-theta_mean)> 0  & e(sample) & theta_mean[_n+2]!=. & theta_mean[_n+1]!=.   &  year<2014
		by ccode: gen HRbetteryear3=0 if e(sample) & theta_mean[_n+3]!=. & theta_mean[_n+2]!=. & theta_mean[_n+1]!=.   &  year<2013
		by ccode: replace HRbetteryear3=1 if (theta_mean[_n+3]-theta_mean)>  0  & e(sample) & theta_mean[_n+3]!=. & theta_mean[_n+2]!=. & theta_mean[_n+1]!=.   &  year<2013
		by ccode: gen HRbetteryear4=0 if e(sample) & theta_mean[_n+4]!=. & theta_mean[_n+3]!=. & theta_mean[_n+2]!=. & theta_mean[_n+1]!=.   &  year<2012
		by ccode: replace HRbetteryear4=1 if (theta_mean[_n+4]-theta_mean)> 0   & e(sample) & theta_mean[_n+4]!=. & theta_mean[_n+3]!=. & theta_mean[_n+2]!=. & theta_mean[_n+1]!=.   &  year<2012
		by ccode: gen HRbetteryear5=0 if e(sample) & theta_mean[_n+5]!=. & theta_mean[_n+4]!=. & theta_mean[_n+3]!=. & theta_mean[_n+2]!=. & theta_mean[_n+1]!=. &  year<2011
		by ccode: replace HRbetteryear5=1 if (theta_mean[_n+5]-theta_mean)> 0  & e(sample) & theta_mean[_n+5]!=. & theta_mean[_n+4]!=. & theta_mean[_n+3]!=. & theta_mean[_n+2]!=. & theta_mean[_n+1]!=. &  year<2011
		count if analysisnegative ==1 & (HRbetteryear1==1 | HRbetteryear2==1| HRbetteryear3==1 | HRbetteryear4==1| HRbetteryear5==1) 
		*1024
		count if (HRbetteryear1==1 | HRbetteryear2==1| HRbetteryear3==1 | HRbetteryear4==1| HRbetteryear5==1) & e(sample)
		*2389

		*so:
		*accuracy = (691+1024)/(1732+1681) = .50249048
		*recall = 691/1742 = .39667049
		*precison = 691/1732= .39896074



		*and now out of sample with CAI #2
		****Trying accuracy, recall, precision 
		clear 
		cd "C:\Users\murdie\Dropbox\ISA 2023 Naz Victor Abortion\Conditional Acceptance Stage 2024\Replication Data for A Ticking Time Bomb"
		use ReplicationDataset.dta, replace
		tsset ccode year
		*Basic model
		reg theta_mean  l.theta_mean  l.cai_cai2  l.polity2 l.lnwdi_pop l.lnwdi_gdpcapcon2010 l.intllocation l.civillocation l.v2lgfemleg  l.iarda_chcatpct  l.iarda_isgenpct i.GEO7 if year<2012, robust
		predict xb if e(sample) 
		gen residual=theta_mean-xb if e(sample) 
		sum residual
		gen analysispositive = 1 if residual> 0    & residual!=. & e(sample) & year==2011
		tab analysispositive 
		*82
		by ccode: gen HRworseyear1=0 if  e(sample) & theta_mean[_n+1]!=. &   year<2015
		by ccode: replace HRworseyear1=1 if FD.theta_mean<  0  & e(sample) & theta_mean[_n+1]!=. &   year<2015
		by ccode: gen HRworseyear2=0 if e(sample) & theta_mean[_n+2]!=. & theta_mean[_n+1]!=.   &  year<2014
		by ccode: replace HRworseyear2=1 if (theta_mean[_n+2]-theta_mean)< 0  & e(sample) & theta_mean[_n+2]!=. & theta_mean[_n+1]!=.   &  year<2014
		by ccode: gen HRworseyear3=0 if e(sample) & theta_mean[_n+3]!=. & theta_mean[_n+2]!=. & theta_mean[_n+1]!=.   &  year<2013
		by ccode: replace HRworseyear3=1 if (theta_mean[_n+3]-theta_mean)<  0  & e(sample) & theta_mean[_n+3]!=. & theta_mean[_n+2]!=. & theta_mean[_n+1]!=.   &  year<2013
		by ccode: gen HRworseyear4=0 if e(sample) & theta_mean[_n+4]!=. & theta_mean[_n+3]!=. & theta_mean[_n+2]!=. & theta_mean[_n+1]!=.   &  year<2012
		by ccode: replace HRworseyear4=1 if (theta_mean[_n+4]-theta_mean)< 0   & e(sample) & theta_mean[_n+4]!=. & theta_mean[_n+3]!=. & theta_mean[_n+2]!=. & theta_mean[_n+1]!=.   &  year<2012
		by ccode: gen HRworseyear5=0 if e(sample) & theta_mean[_n+5]!=. & theta_mean[_n+4]!=. & theta_mean[_n+3]!=. & theta_mean[_n+2]!=. & theta_mean[_n+1]!=. &  year<2011
		by ccode: replace HRworseyear5=1 if (theta_mean[_n+5]-theta_mean)<  0  & e(sample) & theta_mean[_n+5]!=. & theta_mean[_n+4]!=. & theta_mean[_n+3]!=. & theta_mean[_n+2]!=. & theta_mean[_n+1]!=. &  year<2011
		count if analysis==1 & (HRworseyear1==1 | HRworseyear2==1| HRworseyear3==1 | HRworseyear4==1| HRworseyear5==1) & year ==2011
		*24
		count if (HRworseyear1==1 | HRworseyear2==1| HRworseyear3==1 | HRworseyear4==1| HRworseyear5==1) & e(sample)& year==2011
		*60
		tab analysispositive 
		gen analysisnegative = 1 if residual< 0    & residual!=. & e(sample) & year==2011
		tab analysisnegative 
		*67
		by ccode: gen HRbetteryear1=0 if  e(sample) & theta_mean[_n+1]!=. &   year<2015
		by ccode: replace HRbetteryear1=1 if FD.theta_mean>  0  & e(sample) & theta_mean[_n+1]!=. &   year<2015
		by ccode: gen HRbetteryear2=0 if e(sample) & theta_mean[_n+2]!=. & theta_mean[_n+1]!=.   &  year<2014
		by ccode: replace HRbetteryear2=1 if (theta_mean[_n+2]-theta_mean)> 0  & e(sample) & theta_mean[_n+2]!=. & theta_mean[_n+1]!=.   &  year<2014
		by ccode: gen HRbetteryear3=0 if e(sample) & theta_mean[_n+3]!=. & theta_mean[_n+2]!=. & theta_mean[_n+1]!=.   &  year<2013
		by ccode: replace HRbetteryear3=1 if (theta_mean[_n+3]-theta_mean)>  0  & e(sample) & theta_mean[_n+3]!=. & theta_mean[_n+2]!=. & theta_mean[_n+1]!=.   &  year<2013
		by ccode: gen HRbetteryear4=0 if e(sample) & theta_mean[_n+4]!=. & theta_mean[_n+3]!=. & theta_mean[_n+2]!=. & theta_mean[_n+1]!=.   &  year<2012
		by ccode: replace HRbetteryear4=1 if (theta_mean[_n+4]-theta_mean)> 0   & e(sample) & theta_mean[_n+4]!=. & theta_mean[_n+3]!=. & theta_mean[_n+2]!=. & theta_mean[_n+1]!=.   &  year<2012
		by ccode: gen HRbetteryear5=0 if e(sample) & theta_mean[_n+5]!=. & theta_mean[_n+4]!=. & theta_mean[_n+3]!=. & theta_mean[_n+2]!=. & theta_mean[_n+1]!=. &  year<2011
		by ccode: replace HRbetteryear5=1 if (theta_mean[_n+5]-theta_mean)> 0  & e(sample) & theta_mean[_n+5]!=. & theta_mean[_n+4]!=. & theta_mean[_n+3]!=. & theta_mean[_n+2]!=. & theta_mean[_n+1]!=. &  year<2011
		count if analysisnegative ==1 & (HRbetteryear1==1 | HRbetteryear2==1| HRbetteryear3==1 | HRbetteryear4==1| HRbetteryear5==1) & year==2011
		*44
		count if (HRbetteryear1==1 | HRbetteryear2==1| HRbetteryear3==1 | HRbetteryear4==1| HRbetteryear5==1) & e(sample) & year==2011
		*118

		*so:
		*accuracy = (24+44)/(82 +67) =.45637584
		*recall = (24/60) = .4
		*precison = (24/82) = .29268293

		*Table 13: Additional Potential Mediators - confidence in police/justice system
		reg wvs_confpol l.theta_mean l.cai_cai1 d.cai_cai1 l.polity2 l.lnwdi_pop l.lnwdi_gdpcapcon2010 l.intllocation l.civillocation liarda_chcatpct  liarda_isgenpct i.GEO7 , robust
		*outreg2 using Table18RR ,  replace word se label
		reg wvs_confpol l.theta_mean l.cai_cai2 d.cai_cai2 l.polity2 l.lnwdi_pop l.lnwdi_gdpcapcon2010 l.intllocation l.civillocation liarda_chcatpct  liarda_isgenpct i.GEO7 , robust
		*outreg2 using Table18RR ,  append  word se label
		reg wvs_confjs l.theta_mean l.cai_cai1 d.cai_cai1 l.polity2 l.lnwdi_pop l.lnwdi_gdpcapcon2010 l.intllocation l.civillocation liarda_chcatpct  liarda_isgenpct i.GEO7 , robust
		*outreg2 using Table18RR ,  append  word se label
		reg wvs_confjs l.theta_mean l.cai_cai2 d.cai_cai2 l.polity2 l.lnwdi_pop l.lnwdi_gdpcapcon2010 l.intllocation l.civillocation liarda_chcatpct  liarda_isgenpct i.GEO7 , robust
		*outreg2 using Table18RR ,  append  word se label

		*Table 14: confidence in government, willingness to fight 
		reg wvs_confgov l.theta_mean l.cai_cai1 d.cai_cai1 l.polity2 l.lnwdi_pop l.lnwdi_gdpcapcon2010 l.intllocation l.civillocation liarda_chcatpct  liarda_isgenpct i.GEO7 , robust
		*outreg2 using Table19RR ,  replace  word se label
		reg wvs_confgov l.theta_mean l.cai_cai2 d.cai_cai2 l.polity2 l.lnwdi_pop l.lnwdi_gdpcapcon2010 l.intllocation l.civillocation liarda_chcatpct  liarda_isgenpct i.GEO7 , robust
		*outreg2 using Table19RR ,  append  word se label
		reg wvs_fight l.theta_mean l.cai_cai1 d.cai_cai1 l.polity2 l.lnwdi_pop l.lnwdi_gdpcapcon2010 l.intllocation l.civillocation liarda_chcatpct  liarda_isgenpct i.GEO7 , robust
		*outreg2 using Table19RR ,  append  word se label
		reg wvs_fight l.theta_mean l.cai_cai2 d.cai_cai2 l.polity2 l.lnwdi_pop l.lnwdi_gdpcapcon2010 l.intllocation l.civillocation liarda_chcatpct  liarda_isgenpct i.GEO7 , robust
		*outreg2 using Table19RR ,  append  word se label

		*Table 15: it's not general happiness - people are happier in countries with restrictions 
		reg wvs_hap l.theta_mean l.cai_cai1 d.cai_cai1 l.polity2 l.lnwdi_pop l.lnwdi_gdpcapcon2010 l.intllocation l.civillocation liarda_chcatpct  liarda_isgenpct i.GEO7 , robust
		*outreg2 using Table20RR ,  replace word se label
		reg wvs_hap l.theta_mean l.cai_cai2 d.cai_cai2 l.polity2 l.lnwdi_pop l.lnwdi_gdpcapcon2010 l.intllocation l.civillocation liarda_chcatpct  liarda_isgenpct i.GEO7 , robust
		*outreg2 using Table20RR ,  append  word se label

		*Table 16: Non-violent protest  - women and non-women
		*protests go down if abortion rights curtailed
		nbreg nonwomennonvprotgovt l.nonwomennonvprotgovt l.theta_mean l.cai_cai1  l.polity2 l.lnwdi_pop l.lnwdi_gdpcapcon2010 l.intllocation l.civillocation liarda_chcatpct  liarda_isgenpct i.GEO7 , robust
		**outreg2 using Table21RR ,  replace word se label
		nbreg nonwomennonvprotgovt l.nonwomennonvprotgovt l.theta_mean l.cai_cai2  l.polity2 l.lnwdi_pop l.lnwdi_gdpcapcon2010 l.intllocation l.civillocation liarda_chcatpct  liarda_isgenpct i.GEO7 , robust
		**outreg2 using Table21RR ,  append word se label
		nbreg nonvprotgovtwomen l.nonvprotgovtwomen l.theta_mean l.cai_cai1  l.polity2 l.lnwdi_pop l.lnwdi_gdpcapcon2010 l.intllocation l.civillocation liarda_chcatpct  liarda_isgenpct i.GEO7 , robust
		**outreg2 using Table21RR ,  append word se label
		nbreg nonvprotgovtwomen l.nonvprotgovtwomen l.theta_mean l.cai_cai2  l.polity2 l.lnwdi_pop l.lnwdi_gdpcapcon2010 l.intllocation l.civillocation liarda_chcatpct  liarda_isgenpct i.GEO7 , robust
		**outreg2 using Table21RR ,  append word se label

		*Table 17 - Secular values index  
		*another robustness check - secular values index wel_svi * Sacred-vs.-Secular Values - 12-item index measuring a national culture's secular distance to sacredsources of authority, including (1) religious authority (faith, commitment, practice), (2) patrimonial authority (the nation, the state, the parents), (3) order institutions (army, police, courts),and (4) normative authority (anti-bribery, anti-cheating and anti-evasion norms).Source: Index invented and documented inWelzel, Freedom Rising (2013: 63-66), www.cambridge.org/welzel(Online Appendix, p. 12-19), based on data from the World Values Surveys, all countries and timepoints.Scaling: Continuous scale, ranging from a theoretical minimum of 0 when the least secular positionis taken on all 12 items, to a maximum of 1.0 when the most secular position is taken on all 12items. Intermediate positions are given in fractions of 1.0. Country scores are population averages(arithmetic mean) on the 0-1 index.

		*idea is that reducing abortion rights decreases secular values, ultimately harming HR

		reg wel_svi  l.cai_cai1   l.polity2 l.lnwdi_pop l.lnwdi_gdpcapcon2010 l.intllocation l.civillocation l.v2lgfemleg  l.iarda_chcatpct  l.iarda_isgenpct i.GEO7, robust
		**outreg2 using Table24RR ,  replace word se label

		reg wel_svi  l.cai_cai2   l.polity2 l.lnwdi_pop l.lnwdi_gdpcapcon2010 l.intllocation l.civillocation l.v2lgfemleg  l.iarda_chcatpct  l.iarda_isgenpct i.GEO7, robust
		**outreg2 using Table24RR ,  append word se label

		reg theta_mean   l.wel_svi  l.cai_cai1   l.polity2 l.lnwdi_pop l.lnwdi_gdpcapcon2010 l.intllocation l.civillocation l.v2lgfemleg  l.iarda_chcatpct  l.iarda_isgenpct i.GEO7, robust
		**outreg2 using Table24RR ,  append word se label

		reg theta_mean   l.wel_svi  l.cai_cai2   l.polity2 l.lnwdi_pop l.lnwdi_gdpcapcon2010 l.intllocation l.civillocation l.v2lgfemleg  l.iarda_chcatpct  l.iarda_isgenpct i.GEO7, robust
		**outreg2 using Table24RR ,  append word se label

		list country_name year if e(sample)

		*Tables 18 and 19 - Causal Mediation Model with Secular Values Index 
		mediate (theta_mean  lpolity2 llnwdi_pop llnwdi_gdpcapcon2010 lintllocation lcivillocation lv2lgfemleg liarda_chcatpct  liarda_isgenpct GEO7) (lwel_svi  lpolity2 llnwdi_pop llnwdi_gdpcapcon2010 lintllocation lcivillocation  lv2lgfemleg  liarda_chcatpct  liarda_isgenpct GEO7 ) (lcai_cai1, continuous ( 4 3)) , vce(robust)
		**outreg2 using Table25RR ,  replace word se label excel
		estat proportion


		mediate (theta_mean  lpolity2 llnwdi_pop llnwdi_gdpcapcon2010 lintllocation lcivillocation lv2lgfemleg liarda_chcatpct  liarda_isgenpct GEO7) (lwel_svi  lpolity2 llnwdi_pop llnwdi_gdpcapcon2010 lintllocation lcivillocation  lv2lgfemleg  liarda_chcatpct  liarda_isgenpct GEO7 ) (lcai_cai2, continuous ( 0.481 0)) , vce(robust)
		**outreg2 using Table25RR ,  append  word se label excel
		estat proportion

		*Figure 1: Nicaragua

		use ReplicationDataset.dta, replace 
tsset ccode year 

		foreach var of varlist theta_mean cai_cai1 cai_cai2 v2clsocgrp Pct_GBGR_Score_{
			 capture noisily  bysort year: egen yrmean`var' = mean(`var')
		}

		line theta_mean yrmeantheta_mean year if ccode==93 & year>1989, xlabel(1990(5)2020) ylabel(-3.5(1)5.5) legend(label(1 "Nicaragua") label(2 "World Mean")) title("Human Rights Protection Score")
			*graph save Theta_MeanNicaragua, replace
			*graph export  Theta_MeanNicaragua.jpg, replace 
		line cai_cai1 yrmeancai_cai1 year if ccode==93 & year>1989, xlabel(1990(5)2020) ylabel(0(1)7) legend(label(1 "Nicaragua") label(2 "World Mean")) title("Comparative Abortion Index 1, (0 to 7)")
			*graph save cai1Nicaragua, replace
			*graph export  cai1Nicaragua.jpg, replace 
		line cai_cai2 yrmeancai_cai2 year if ccode==93 & year>1989, xlabel(1990(5)2020) ylabel(0(.1)1) legend(label(1 "Nicaragua") label(2 "World Mean")) title("Comparative Abortion Index 2, (0 to 1)")
			*graph save cai2Nicaragua, replace
			*graph export  cai2Nicaragua.jpg, replace 
		line v2clsocgrp yrmeanv2clsocgrp year if ccode==93 & year>1989, xlabel(1990(5)2020) ylabel(-3.1(.5)3.6) legend(label(1 "Nicaragua") label(2 "World Mean")) title("Social Group Equality in Respect for Civil Liberties")
			*graph save socialgroupNicaragua, replace
			*graph export  socialgroupNicaragua.jpg, replace 
		line Pct_GBGR_Score_ yrmeanPct_GBGR_Score_ year if ccode==93 & year>2010 & year<2015, xlabel(2011(1)2014) ylabel(0(10)100) legend(label(1 "Nicaragua") label(2 "World Mean")) title("Gay Rights Barometer")
			*graph save gayNicaragua, replace
			*graph export  gayNicaragua.jpg, replace 
		*graph combine cai1Nicaragua.gph cai2Nicaragua.gph, scale(.8)
		*graph save caiNicaragua.gph, replace
		*graph export caiNicaragua.jpg, replace
		*graph combine Theta_MeanNicaragua.gph socialgroupNicaragua.gph gayNicaragua.gph , scale(.6)
		*graph save rightsNicaragua.gph, replace
		*graph export rightsNicaragua.jpg, replace	

		*Poland
		line theta_mean yrmeantheta_mean year if ccode==290 & year>1989, xlabel(1990(5)2020) ylabel(-3.5(1)5.5) legend(label(1 "Poland") label(2 "World Mean")) title("Human Rights Protection Score")
			*graph save Theta_MeanPoland, replace
			*graph export  Theta_MeanPoland.jpg, replace 
		line cai_cai1 yrmeancai_cai1 year if ccode==290 & year>1989, xlabel(1990(5)2020) ylabel(0(1)7) legend(label(1 "Poland") label(2 "World Mean")) title("Comparative Abortion Index 1, (0 to 7)")
			*graph save cai1Poland, replace
			*graph export  cai1Poland.jpg, replace 
		line cai_cai2 yrmeancai_cai2 year if ccode==290 & year>1989, xlabel(1990(5)2020) ylabel(0(.1)1) legend(label(1 "Poland") label(2 "World Mean")) title("Comparative Abortion Index 2, (0 to 1)")
			*graph save cai2Poland, replace
			*graph export  cai2Poland.jpg, replace 
		line v2clsocgrp yrmeanv2clsocgrp year if ccode==290 & year>1989, xlabel(1990(5)2020) ylabel(-3.1(.5)3.6) legend(label(1 "Poland") label(2 "World Mean")) title("Social Group Equality in Respect for Civil Liberties")
			*graph save socialgroupPoland, replace
			*graph export  socialgroupPoland.jpg, replace 
		line Pct_GBGR_Score_ yrmeanPct_GBGR_Score_ year if ccode==290 & year>2010 & year<2015, xlabel(2011(1)2014) ylabel(0(10)100) legend(label(1 "Poland") label(2 "World Mean")) title("Gay Rights Barometer")
			*graph save gayPoland, replace
			*graph export  gayPoland.jpg, replace 
		*graph combine cai1Poland.gph cai2Poland.gph, scale(.8)
		*graph save caiPoland.gph, replace
		*graph export caiPoland.jpg, replace
		*graph combine Theta_MeanPoland.gph socialgroupPoland.gph gayPoland.gph , scale(.6)
		*graph save rightsPoland.gph, replace
		*graph export rightsPoland.jpg, replace	
		
*Additional Robustness Tests found in the document on Dataverse
use ReplicationDataset.dta, replace
tsset ccode year 
*Table 1:
*****Summary statistics 
reg theta_mean  l.theta_mean  l.cai_cai1   l.polity2 l.lnwdi_pop l.lnwdi_gdpcapcon2010 l.intllocation l.civillocation l.v2lgfemleg  l.iarda_chcatpct  l.iarda_isgenpct i.GEO7, robust
sum theta_mean   lv2clsocgrp lcai_cai1   lcai_cai2  lpolity2 llnwdi_pop llnwdi_gdpcapcon2010 lintllocation lcivillocation lv2lgfemleg  liarda_chcatpct  liarda_isgenpct GEO7 if e(sample)
*Tables 2-5: Correlations for CAI and women's variables
*General QoG and V-Dem Indicators
mkcorr cai_cai1 cai_cai2  wecon wosoc wopol wdi_wip wdi_wombuslawi WBL_index  v2csgender v2pepwrgen v2clgencl v2peapsgen v2peasjgen v2xpe_exlgender v2x_gender, log(pw1RR) lab replace
*WBL
mkcorr cai_cai1 cai_cai2  WBL_index GR1_mobility GR2_workplace GR3_pay GR4_marriage GR5_parenthood GR6_entrprnshp GR7_assets GR8_pension gr1_1passpmrd gr1_2trvlctrymrd gr1_3trvlhmmrd gr1_4whlivemrd gr2_5profhmmrd gr2_6nondiscempl gr2_7sexhrssemp gr2_8sexcomb gr3_9eqremunval gr3_10nprgeqnight gr3_11jobshazard gr3_12industry gr4_13obeymrd gr4_14hhmrd gr4_15domleg gr4_16dvrcjdgmnt gr4_17equalremarr gr5_18wpdleave14 gr5_19govleaveprov gr5_20patleave gr5_21paidprntl gr5_22pregdism gr6_23cntrcthmmrd gr6_24regbusmrd gr6_25bnkaccmrd gr6_26disgend gr7_27prtyeqownmrdbth gr7_28prtyeqsondght gr7_29prtyeqsuvrspse gr7_30prtylegadmin gr7_31valnonmntry gr8_32retagequal gr8_33penagequal gr8_34mandagequal gr8_35carecredit mtrnity_days ptrnity_days prntal_shrd prntal_mom, log(pw2RR) lab replace
*SIGI
mkcorr cai_cai1 cai_cai2 SIGI SIGIDF SIGIRPI SIGIAPFA SIGIRCL, log(pw3RR) lab replace 
*correlation with the variables in our models (not pairwise)
mkcorr theta_mean   v2clsocgrp  cai_cai1   polity2 lnwdi_pop lnwdi_gdpcapcon2010 intllocation civillocation v2lgfemleg  iarda_chcatpct  iarda_isgenpct GEO7, log(pw4RR) lab replace casewise

*Tables 6-8:Examining those that backslide 
browse cname year if  BackwardsAbortioncai1==1
browse cname year if  BackwardsAbortioncai2==1
browse cname year if  Largerthanorequal2dropcai1 ==1
browse cname year if  Largerthan2SDdropcai2  ==1

browse cname year lcai_cai1 cai_cai1 lcai_cai2 cai_cai2 Dcai_cai1  Backwardsc* if BackwardsAbortioncai2==1


*Robustness models: 
**Table 9: Different Dependent Variables
*physint 
tsset ccode year 
reg physint  l.physint  l.cai_cai1   l.polity2 l.lnwdi_pop l.lnwdi_gdpcapcon2010 l.intllocation l.civillocation l.v2lgfemleg  l.iarda_chcatpct  l.iarda_isgenpct i.GEO7, robust
**outreg2 using Table3RR , replace  word se label
reg physint  l.physint   l.cai_cai2   l.polity2 l.lnwdi_pop l.lnwdi_gdpcapcon2010 l.intllocation l.civillocation l.v2lgfemleg  l.iarda_chcatpct  l.iarda_isgenpct i.GEO7, robust
**outreg2 using Table3RR ,  append word se label
*gd_ptsa 
reg gd_ptsa  l.gd_ptsa   l.cai_cai1   l.polity2 l.lnwdi_pop l.lnwdi_gdpcapcon2010 l.intllocation l.civillocation l.v2lgfemleg  l.iarda_chcatpct  l.iarda_isgenpct i.GEO7, robust
**outreg2 using Table3RR ,  append  word se label
reg gd_ptsa   l.gd_ptsa    l.cai_cai2   l.polity2 l.lnwdi_pop l.lnwdi_gdpcapcon2010 l.intllocation l.civillocation l.v2lgfemleg  l.iarda_chcatpct  l.iarda_isgenpct i.GEO7, robust
**outreg2 using Table3RR ,  append word se label
*gd_ptss 
reg gd_ptss  l.gd_ptss   l.cai_cai1   l.polity2 l.lnwdi_pop l.lnwdi_gdpcapcon2010 l.intllocation l.civillocation l.v2lgfemleg  l.iarda_chcatpct  l.iarda_isgenpct i.GEO7, robust
**outreg2 using Table3RR ,  append  word se label
reg gd_ptss   l.gd_ptss    l.cai_cai2   l.polity2 l.lnwdi_pop l.lnwdi_gdpcapcon2010 l.intllocation l.civillocation l.v2lgfemleg  l.iarda_chcatpct  l.iarda_isgenpct i.GEO7, robust
**outreg2 using Table3RR ,  append word se label


*Table 10: Subcomponents driven by killing and disappearances -
ologit polpris i.l.polpris   lcai_cai2   lpolity2 llnwdi_pop llnwdi_gdpcapcon2010 lintllocation lcivillocation lv2lgfemleg  liarda_chcatpct  liarda_isgenpct i.GEO7, robust
**outreg2 using Table4RR , replace  word se label
ologit tort  i.l.tort lcai_cai2   lpolity2 llnwdi_pop llnwdi_gdpcapcon2010 lintllocation lcivillocation lv2lgfemleg  liarda_chcatpct  liarda_isgenpct i.GEO7, robust
**outreg2 using Table4RR , append word se label
ologit kill  i.l.kill lcai_cai2   lpolity2 llnwdi_pop llnwdi_gdpcapcon2010 lintllocation lcivillocation lv2lgfemleg  liarda_chcatpct  liarda_isgenpct i.GEO7, robust
**outreg2 using Table4RR , append word se label
ologit disap i.l.disap lcai_cai2   lpolity2 llnwdi_pop llnwdi_gdpcapcon2010 lintllocation lcivillocation lv2lgfemleg  liarda_chcatpct  liarda_isgenpct i.GEO7, robust
**outreg2 using Table4RR , append word se label
reg v2clkill l.v2clkill lcai_cai2   lpolity2 llnwdi_pop llnwdi_gdpcapcon2010 lintllocation lcivillocation lv2lgfemleg  liarda_chcatpct  liarda_isgenpct i.GEO7, robust
**outreg2 using Table4RR , append word se label
reg v2cltort l.v2cltort lcai_cai2   lpolity2 llnwdi_pop llnwdi_gdpcapcon2010 lintllocation lcivillocation lv2lgfemleg  liarda_chcatpct  liarda_isgenpct i.GEO7, robust
**outreg2 using Table4RR , append word se label
*disappearances still works if take out the Americas:
ologit disap lcai_cai2   lpolity2 llnwdi_pop llnwdi_gdpcapcon2010 lintllocation lcivillocation lv2lgfemleg  liarda_chcatpct  liarda_isgenpct i.GEO7 if GEO2!=1, robust
**outreg2 using Table4RR , append word se label


*Adding Additional Control Variables 
*Table 11: Cheibub, Gandhi and Vreeland indicator for democracy
reg theta_mean  l.theta_mean  l.cai_cai1   l.chga_demo l.lnwdi_pop l.lnwdi_gdpcapcon2010 l.intllocation l.civillocation l.v2lgfemleg  l.iarda_chcatpct  l.iarda_isgenpct i.GEO7, robust
**outreg2 using Table5RR ,  replace word se label
*Model 2: theta_mean and cai2
reg theta_mean  l.theta_mean  l.cai_cai2   l.chga_demo l.lnwdi_pop l.lnwdi_gdpcapcon2010 l.intllocation l.civillocation l.v2lgfemleg  l.iarda_chcatpct  l.iarda_isgenpct i.GEO7, robust
**outreg2 using Table5RR ,  append word se label
*Model 3: social group cl & cai1
reg v2clsocgrp l.v2clsocgrp   l.cai_cai1   l.chga_demo l.lnwdi_pop l.lnwdi_gdpcapcon2010 l.intllocation l.civillocation l.v2lgfemleg  l.iarda_chcatpct  l.iarda_isgenpct i.GEO7, robust
**outreg2 using Table5RR ,  append word se label
*Model 4: social group and cai2
reg v2clsocgrp l.v2clsocgrp   l.cai_cai2   l.chga_demo l.lnwdi_pop l.lnwdi_gdpcapcon2010 l.intllocation l.civillocation l.v2lgfemleg  l.iarda_chcatpct  l.iarda_isgenpct i.GEO7, robust
**outreg2 using Table5RR ,  append  word se label
*Model 5: theta_mean and cai1, with social group cl included 
reg theta_mean  l.theta_mean  l.v2clsocgrp  l.cai_cai1   l.chga_demo l.lnwdi_pop l.lnwdi_gdpcapcon2010 l.intllocation l.civillocation l.v2lgfemleg  l.iarda_chcatpct  l.iarda_isgenpct i.GEO7, robust
**outreg2 using Table5RR ,  append word se label
*Model 6: theta_mean and cai2
reg theta_mean  l.theta_mean  l.v2clsocgrp  l.cai_cai2   l.chga_demo l.lnwdi_pop l.lnwdi_gdpcapcon2010 l.intllocation l.civillocation l.v2lgfemleg  l.iarda_chcatpct  l.iarda_isgenpct i.GEO7, robust
**outreg2 using Table5RR ,  append word se label



*Table 12: control for religious freedom
*Model 1: theta_mean and cai1
reg theta_mean  l.theta_mean  l.cai_cai1   l.polity2 l.lnwdi_pop l.lnwdi_gdpcapcon2010 l.intllocation l.civillocation l.v2lgfemleg  l.iarda_chcatpct  l.iarda_isgenpct i.GEO7 l.rel_free, robust
**outreg2 using Table7RR ,  replace word se label
*Model 2: theta_mean and cai2
reg theta_mean  l.theta_mean  l.cai_cai2   l.polity2 l.lnwdi_pop l.lnwdi_gdpcapcon2010 l.intllocation l.civillocation l.v2lgfemleg  l.iarda_chcatpct  l.iarda_isgenpct i.GEO7 l.rel_free, robust
**outreg2 using Table7RR ,  append word se label
*Model 3: social group cl & cai1
reg v2clsocgrp l.v2clsocgrp   l.cai_cai1   l.polity2 l.lnwdi_pop l.lnwdi_gdpcapcon2010 l.intllocation l.civillocation l.v2lgfemleg  l.iarda_chcatpct  l.iarda_isgenpct i.GEO7 l.rel_free, robust
**outreg2 using Table7RR ,  append word se label
*Model 4: social group and cai2
reg v2clsocgrp l.v2clsocgrp   l.cai_cai2   l.polity2 l.lnwdi_pop l.lnwdi_gdpcapcon2010 l.intllocation l.civillocation l.v2lgfemleg  l.iarda_chcatpct  l.iarda_isgenpct i.GEO7 l.rel_free, robust
**outreg2 using Table7RR ,  append  word se label
*Model 5: theta_mean and cai1, with social group cl included 
reg theta_mean  l.theta_mean  l.v2clsocgrp  l.cai_cai1   l.polity2 l.lnwdi_pop l.lnwdi_gdpcapcon2010 l.intllocation l.civillocation l.v2lgfemleg  l.iarda_chcatpct  l.iarda_isgenpct i.GEO7 l.rel_free, robust
**outreg2 using Table7RR ,  append word se label
*Model 6: theta_mean and cai2
reg theta_mean  l.theta_mean  l.v2clsocgrp  l.cai_cai2   l.polity2 l.lnwdi_pop l.lnwdi_gdpcapcon2010 l.intllocation l.civillocation l.v2lgfemleg  l.iarda_chcatpct  l.iarda_isgenpct i.GEO7 l.rel_free, robust
**outreg2 using Table7RR ,  append word se label


*Table 13: control for globalization
*Model 1: theta_mean and cai1
reg theta_mean  l.theta_mean  l.cai_cai1   l.polity2 l.lnwdi_pop l.lnwdi_gdpcapcon2010 l.intllocation l.civillocation l.v2lgfemleg  l.iarda_chcatpct  l.iarda_isgenpct i.GEO7 l.dr_ig, robust
**outreg2 using Table8RR ,  replace word se label
*Model 2: theta_mean and cai2
reg theta_mean  l.theta_mean  l.cai_cai2   l.polity2 l.lnwdi_pop l.lnwdi_gdpcapcon2010 l.intllocation l.civillocation l.v2lgfemleg  l.iarda_chcatpct  l.iarda_isgenpct i.GEO7 l.dr_ig, robust
**outreg2 using Table8RR ,  append word se label
*Model 3: social group cl & cai1
reg v2clsocgrp l.v2clsocgrp   l.cai_cai1   l.polity2 l.lnwdi_pop l.lnwdi_gdpcapcon2010 l.intllocation l.civillocation l.v2lgfemleg  l.iarda_chcatpct  l.iarda_isgenpct i.GEO7 l.dr_ig,robust
**outreg2 using Table8RR ,  append word se label
*Model 4: social group and cai2
reg v2clsocgrp l.v2clsocgrp   l.cai_cai2   l.polity2 l.lnwdi_pop l.lnwdi_gdpcapcon2010 l.intllocation l.civillocation l.v2lgfemleg  l.iarda_chcatpct  l.iarda_isgenpct i.GEO7 l.dr_ig ,robust
**outreg2 using Table8RR ,  append  word se label
*Model 5: theta_mean and cai1, with social group cl included 
reg theta_mean  l.theta_mean  l.v2clsocgrp  l.cai_cai1   l.polity2 l.lnwdi_pop l.lnwdi_gdpcapcon2010 l.intllocation l.civillocation l.v2lgfemleg  l.iarda_chcatpct  l.iarda_isgenpct i.GEO7 l.dr_ig, robust
**outreg2 using Table8RR ,  append word se label
*Model 6: theta_mean and cai2
reg theta_mean  l.theta_mean  l.v2clsocgrp  l.cai_cai2   l.polity2 l.lnwdi_pop l.lnwdi_gdpcapcon2010 l.intllocation l.civillocation l.v2lgfemleg  l.iarda_chcatpct  l.iarda_isgenpct i.GEO7 l.dr_ig, robust
**outreg2 using Table8RR ,  append word se label


*Table 14: wopol
*Model 1: theta_mean and cai1
reg theta_mean  l.theta_mean  l.cai_cai1   l.polity2 l.lnwdi_pop l.lnwdi_gdpcapcon2010 l.intllocation l.civillocation l.v2lgfemleg  l.iarda_chcatpct  l.iarda_isgenpct i.GEO7 l.wopol , robust
**outreg2 using Table9RR ,  replace word se label
*Model 2: theta_mean and cai2
reg theta_mean  l.theta_mean  l.cai_cai2   l.polity2 l.lnwdi_pop l.lnwdi_gdpcapcon2010 l.intllocation l.civillocation l.v2lgfemleg  l.iarda_chcatpct  l.iarda_isgenpct i.GEO7 l.wopol, robust
**outreg2 using Table9RR ,  append word se label
*Model 3: social group cl & cai1
reg v2clsocgrp l.v2clsocgrp   l.cai_cai1   l.polity2 l.lnwdi_pop l.lnwdi_gdpcapcon2010 l.intllocation l.civillocation l.v2lgfemleg  l.iarda_chcatpct  l.iarda_isgenpct i.GEO7 l.wopol, robust
**outreg2 using Table9RR ,  append word se label
*Model 4: social group and cai2
reg v2clsocgrp l.v2clsocgrp   l.cai_cai2   l.polity2 l.lnwdi_pop l.lnwdi_gdpcapcon2010 l.intllocation l.civillocation l.v2lgfemleg  l.iarda_chcatpct  l.iarda_isgenpct i.GEO7 l.wopol, robust
**outreg2 using Table9RR ,  append  word se label
*Model 5: theta_mean and cai1, with social group cl included 
reg theta_mean  l.theta_mean  l.v2clsocgrp  l.cai_cai1   l.polity2 l.lnwdi_pop l.lnwdi_gdpcapcon2010 l.intllocation l.civillocation l.v2lgfemleg  l.iarda_chcatpct  l.iarda_isgenpct i.GEO7 l.wopol, robust
**outreg2 using Table9RR ,  append word se label
*Model 6: theta_mean and cai2
reg theta_mean  l.theta_mean  l.v2clsocgrp  l.cai_cai2   l.polity2 l.lnwdi_pop l.lnwdi_gdpcapcon2010 l.intllocation l.civillocation l.v2lgfemleg  l.iarda_chcatpct  l.iarda_isgenpct i.GEO7 l.wopol, robust
**outreg2 using Table9RR ,  append word se label

*Table 15: add BMP women protest variable
*Model 1: theta_mean and cai1
reg theta_mean  l.theta_mean  l.cai_cai1   l.polity2 l.lnwdi_pop l.lnwdi_gdpcapcon2010 l.intllocation l.civillocation l.v2lgfemleg  l.iarda_chcatpct  l.iarda_isgenpct i.GEO7 l.totalwomenprotest , robust
**outreg2 using Table10RR ,  replace word se label
*Model 2: theta_mean and cai2
reg theta_mean  l.theta_mean  l.cai_cai2   l.polity2 l.lnwdi_pop l.lnwdi_gdpcapcon2010 l.intllocation l.civillocation l.v2lgfemleg  l.iarda_chcatpct  l.iarda_isgenpct i.GEO7 l.totalwomenprotest, robust
**outreg2 using Table10RR ,  append word se label
*Model 3: social group cl & cai1
reg v2clsocgrp l.v2clsocgrp   l.cai_cai1   l.polity2 l.lnwdi_pop l.lnwdi_gdpcapcon2010 l.intllocation l.civillocation l.v2lgfemleg  l.iarda_chcatpct  l.iarda_isgenpct i.GEO7 l.totalwomenprotest, robust
**outreg2 using Table10RR ,  append word se label
*Model 4: social group and cai2
reg v2clsocgrp l.v2clsocgrp   l.cai_cai2   l.polity2 l.lnwdi_pop l.lnwdi_gdpcapcon2010 l.intllocation l.civillocation l.v2lgfemleg  l.iarda_chcatpct  l.iarda_isgenpct i.GEO7 l.totalwomenprotest, robust
**outreg2 using Table10RR ,  append  word se label
*Model 5: theta_mean and cai1, with social group cl included 
reg theta_mean  l.theta_mean  l.v2clsocgrp  l.cai_cai1   l.polity2 l.lnwdi_pop l.lnwdi_gdpcapcon2010 l.intllocation l.civillocation l.v2lgfemleg  l.iarda_chcatpct  l.iarda_isgenpct i.GEO7 l.totalwomenprotest, robust
**outreg2 using Table10RR ,  append word se label
*Model 6: theta_mean and cai2
reg theta_mean  l.theta_mean  l.v2clsocgrp  l.cai_cai2   l.polity2 l.lnwdi_pop l.lnwdi_gdpcapcon2010 l.intllocation l.civillocation l.v2lgfemleg  l.iarda_chcatpct  l.iarda_isgenpct i.GEO7 l.totalwomenprotest, robust
**outreg2 using Table10RR ,  append word se label


*Table 16: without independent variables lagged one year
*Table 1: Dynamic Model - Abortion Rights and Reduction of social group civil liberties and abortion rights and reduction of human rights 
*Model 1: theta_mean and cai1
reg theta_mean  l.theta_mean  cai_cai1   polity2 lnwdi_pop lnwdi_gdpcapcon2010 intllocation civillocation v2lgfemleg  iarda_chcatpct  iarda_isgenpct i.GEO7, robust
**outreg2 using Table22RR ,  replace word se label
*Model 2: theta_mean and cai2
reg theta_mean  l.theta_mean  cai_cai2   polity2 lnwdi_pop lnwdi_gdpcapcon2010 intllocation civillocation v2lgfemleg  iarda_chcatpct  iarda_isgenpct i.GEO7, robust
**outreg2 using Table22RR ,  append word se label
*Model 3: social group cl & cai1
reg v2clsocgrp l.v2clsocgrp   cai_cai1    polity2 lnwdi_pop lnwdi_gdpcapcon2010 intllocation civillocation v2lgfemleg  iarda_chcatpct  iarda_isgenpct i.GEO7, robust
**outreg2 using Table22RR ,  append word se label
*Model 4: social group and cai2
reg v2clsocgrp l.v2clsocgrp   cai_cai2    polity2 lnwdi_pop lnwdi_gdpcapcon2010 intllocation civillocation v2lgfemleg  iarda_chcatpct  iarda_isgenpct i.GEO7, robust
**outreg2 using Table22RR ,  append  word se label
*Model 5: theta_mean and cai1, with social group cl included 
reg theta_mean  l.theta_mean  v2clsocgrp  cai_cai1   polity2 lnwdi_pop lnwdi_gdpcapcon2010 intllocation civillocation v2lgfemleg  iarda_chcatpct  iarda_isgenpct GEO7, robust
**outreg2 using Table22RR ,  append word se label
*Model 6: theta_mean and cai2
reg theta_mean  l.theta_mean  v2clsocgrp  cai_cai2   polity2 lnwdi_pop lnwdi_gdpcapcon2010 intllocation civillocation v2lgfemleg  iarda_chcatpct  iarda_isgenpct i.GEO7, robust
**outreg2 using Table22RR ,  append word se label


*Table 17: without the controls for catholic and islam 
*Model 1: theta_mean and cai1
reg theta_mean  l.theta_mean  l.cai_cai1   l.polity2 l.lnwdi_pop l.lnwdi_gdpcapcon2010 l.intllocation l.civillocation l.v2lgfemleg   i.GEO7, robust
**outreg2 using Table23RR ,  replace word se label
*Model 2: theta_mean and cai2
reg theta_mean  l.theta_mean  l.cai_cai2   l.polity2 l.lnwdi_pop l.lnwdi_gdpcapcon2010 l.intllocation l.civillocation l.v2lgfemleg   i.GEO7, robust
**outreg2 using Table23RR ,  append word se label
*Model 3: social group cl & cai1
reg v2clsocgrp l.v2clsocgrp   l.cai_cai1   l.polity2 l.lnwdi_pop l.lnwdi_gdpcapcon2010 l.intllocation l.civillocation l.v2lgfemleg   i.GEO7, robust
**outreg2 using Table23RR ,  append word se label
*Model 4: social group and cai2
reg v2clsocgrp l.v2clsocgrp   l.cai_cai2   l.polity2 l.lnwdi_pop l.lnwdi_gdpcapcon2010 l.intllocation l.civillocation l.v2lgfemleg   i.GEO7, robust
**outreg2 using Table23RR ,  append  word se label
*Model 5: theta_mean and cai1, with social group cl included 
reg theta_mean  l.theta_mean  l.v2clsocgrp  l.cai_cai1   l.polity2 l.lnwdi_pop l.lnwdi_gdpcapcon2010 l.intllocation l.civillocation l.v2lgfemleg   i.GEO7, robust
**outreg2 using Table23RR ,  append word se label
*Model 6: theta_mean and cai2
reg theta_mean  l.theta_mean  l.v2clsocgrp  l.cai_cai2   l.polity2 l.lnwdi_pop l.lnwdi_gdpcapcon2010 l.intllocation l.civillocation l.v2lgfemleg  i.GEO7, robust
**outreg2 using Table23RR ,  append word se label


*Table 18: Include polity squared 
*Model 1: theta_mean and cai1
reg theta_mean  l.theta_mean  l.cai_cai1   c.l.polity2##c.l.polity2 l.lnwdi_pop l.lnwdi_gdpcapcon2010 l.intllocation l.civillocation l.v2lgfemleg  l.iarda_chcatpct  l.iarda_isgenpct i.GEO7, robust
**outreg2 using Table26RR ,  replace word se label
*Model 2: theta_mean and cai2
reg theta_mean  l.theta_mean  l.cai_cai2   c.l.polity2##c.l.polity2  l.lnwdi_pop l.lnwdi_gdpcapcon2010 l.intllocation l.civillocation l.v2lgfemleg  l.iarda_chcatpct  l.iarda_isgenpct i.GEO7, robust
**outreg2 using Table26RR ,  append word se label
*Model 3: social group cl & cai1
reg v2clsocgrp l.v2clsocgrp   l.cai_cai1    c.l.polity2##c.l.polity2  l.lnwdi_pop l.lnwdi_gdpcapcon2010 l.intllocation l.civillocation l.v2lgfemleg  l.iarda_chcatpct  l.iarda_isgenpct i.GEO7, robust
**outreg2 using Table26RR ,  append word se label
*Model 4: social group and cai2
reg v2clsocgrp l.v2clsocgrp   l.cai_cai2    c.l.polity2##c.l.polity2  l.lnwdi_pop l.lnwdi_gdpcapcon2010 l.intllocation l.civillocation l.v2lgfemleg  l.iarda_chcatpct  l.iarda_isgenpct i.GEO7, robust
**outreg2 using Table26RR ,  append  word se label
*Model 5: theta_mean and cai1, with social group cl included 
reg theta_mean  l.theta_mean  l.v2clsocgrp  l.cai_cai1    c.l.polity2##c.l.polity2  l.lnwdi_pop l.lnwdi_gdpcapcon2010 l.intllocation l.civillocation l.v2lgfemleg  l.iarda_chcatpct  l.iarda_isgenpct i.GEO7, robust
**outreg2 using Table26RR ,  append word se label
*Model 6: theta_mean and cai2
reg theta_mean  l.theta_mean  l.v2clsocgrp  l.cai_cai2   c.l.polity2##c.l.polity2   l.lnwdi_pop l.lnwdi_gdpcapcon2010 l.intllocation l.civillocation l.v2lgfemleg  l.iarda_chcatpct  l.iarda_isgenpct i.GEO7, robust
**outreg2 using Table26RR ,  append word se label


*Table 19: Individual indicators for cai rights 
reg theta_mean  l.theta_mean  l.cai_foetal   l.polity2 l.lnwdi_pop l.lnwdi_gdpcapcon2010 l.intllocation l.civillocation l.v2lgfemleg  l.iarda_chcatpct  l.iarda_isgenpct i.GEO7, robust
**outreg2 using Table27RR ,  replace word se label
reg theta_mean  l.theta_mean  l.cai_life  l.polity2 l.lnwdi_pop l.lnwdi_gdpcapcon2010 l.intllocation l.civillocation l.v2lgfemleg  l.iarda_chcatpct  l.iarda_isgenpct i.GEO7, robust
**outreg2 using Table27RR ,  append word se label
reg theta_mean  l.theta_mean l.cai_mental    l.polity2 l.lnwdi_pop l.lnwdi_gdpcapcon2010 l.intllocation l.civillocation l.v2lgfemleg  l.iarda_chcatpct  l.iarda_isgenpct i.GEO7, robust
**outreg2 using Table27RR ,  append word se label
reg theta_mean  l.theta_mean l.cai_physical    l.polity2 l.lnwdi_pop l.lnwdi_gdpcapcon2010 l.intllocation l.civillocation l.v2lgfemleg  l.iarda_chcatpct  l.iarda_isgenpct i.GEO7, robust
**outreg2 using Table27RR ,  append word se label
reg theta_mean  l.theta_mean l.cai_rape  l.polity2 l.lnwdi_pop l.lnwdi_gdpcapcon2010 l.intllocation l.civillocation l.v2lgfemleg  l.iarda_chcatpct  l.iarda_isgenpct i.GEO7, robust
**outreg2 using Table27RR ,  append word se label
reg theta_mean  l.theta_mean   l.cai_request l.polity2 l.lnwdi_pop l.lnwdi_gdpcapcon2010 l.intllocation l.civillocation l.v2lgfemleg  l.iarda_chcatpct  l.iarda_isgenpct i.GEO7, robust
**outreg2 using Table27RR ,  append  word se label
reg theta_mean  l.theta_mean  l.cai_social   l.polity2 l.lnwdi_pop l.lnwdi_gdpcapcon2010 l.intllocation l.civillocation l.v2lgfemleg  l.iarda_chcatpct  l.iarda_isgenpct i.GEO7, robust
**outreg2 using Table27RR ,  append word se label

*Tables 20-22.32

use  ReplicationDataset.dta, replace 

*LGBT rights Dicklitch-Nelson et al JHR

*asdoc tab Score_Grade_ lcai_cai1,  nokey subopt(column row) chi2 replace save(LGBTresults.doc)

foreach var of varlist  nonegLoTCriminal   nonegLoTDissident nonegLoTMarginalized  nonegLoTStateAgent  {

*asdoc tab `var' lcai_cai1, nokey subopt(column row) chi2 append  save(ITTresults.doc)


}

foreach var of varlist nonegLoTUnknownCriminal nonegLoTUnknownDissident nonegLoTUnknownMarginalized nonegLoTUnknownStateAgent nonegLoTUnknownUnknown nonegLoTPoliceCriminal nonegLoTPoliceDissident nonegLoTPoliceMarginalized nonegLoTPoliceStateAgent nonegLoTPoliceUnknown nonegLoTPrisonCriminal nonegLoTPrisonDissident nonegLoTPrisonMarginalized nonegLoTPrisonStateAgent nonegLoTPrisonUnknown nonegLoTMilitaryCriminal nonegLoTMilitaryDissident nonegLoTMilitaryMarginalized nonegLoTMilitaryStateAgent nonegLoTMilitaryUnknown nonegLoTIntelligenceCriminal nonegLoTIntelligenceDissident nonegLoTIntelligenceMarginalized nonegLoTIntelligenceUnknown nonegLoTImmigrationCriminal nonegLoTImmigrationDissident nonegLoTImmigrationMarginalized nonegLoTImmigrationUnknown nonegLoTParamilitaryCriminal nonegLoTParamilitaryDissident nonegLoTParamilitaryMarginalized nonegLoTParamilitaryUnknown{

*asdoc tab `var' lcai_cai1,  nokey subopt(column row) chi2 append save(ITTresults.doc)


}



*Table 23: new results with Gay rights
tsset ccode year 
ologit Score_Grade_ Dcai_cai2 lcai_cai2 l.theta_mean lpolity2 llnwdi_pop llnwdi_gdpcapcon2010 lintllocation lcivillocation lv2lgfemleg  liarda_chcatpct  liarda_isgenpct GEO7   , cluster(ccode)
*outreg2 using Tablegay, replace word se label
reg Pct_GBGR_Score_ Dcai_cai2 lcai_cai2  l.theta_mean lpolity2 llnwdi_pop llnwdi_gdpcapcon2010 lintllocation lcivillocation lv2lgfemleg  liarda_chcatpct  liarda_isgenpct GEO7   , robust
*outreg2 using Tablegay, append word se label
ologit Score_Grade_ Dcai_cai1 lcai_cai1 l.theta_mean  lpolity2 llnwdi_pop llnwdi_gdpcapcon2010 lintllocation lcivillocation lv2lgfemleg  liarda_chcatpct  liarda_isgenpct GEO7   , cluster(ccode)
*outreg2 using Tablegay, append word se label
reg Pct_GBGR_Score_ Dcai_cai1 lcai_cai1 l.theta_mean  lpolity2 llnwdi_pop llnwdi_gdpcapcon2010 lintllocation lcivillocation lv2lgfemleg  liarda_chcatpct  liarda_isgenpct GEO7   , robust
*outreg2 using Tablegay, append word se label


*Table 24: New results with ITT & CAI1 
ologit nonegLoTC Dcai_cai1 lcai_cai1  lpolity2 llnwdi_pop llnwdi_gdpcapcon2010 lintllocation lcivillocation lv2lgfemleg  liarda_chcatpct  liarda_isgenpct GEO7  if Rst!=1 , cluster(ccode)
*outreg2 using Tableittrr1 ,  replace word se label
ologit nonegLoTD Dcai_cai1 lcai_cai1  lpolity2 llnwdi_pop llnwdi_gdpcapcon2010 lintllocation lcivillocation lv2lgfemleg  liarda_chcatpct  liarda_isgenpct GEO7  if Rst!=1 , cluster(ccode)
*outreg2 using Tableittrr1 ,  append word se label
ologit nonegLoTMa Dcai_cai1 lcai_cai1  lpolity2 llnwdi_pop llnwdi_gdpcapcon2010 lintllocation lcivillocation lv2lgfemleg  liarda_chcatpct  liarda_isgenpct GEO7  if Rst!=1 , cluster(ccode)
*outreg2 using Tableittrr1 ,  append word se label
ologit nonegLoTUnknown Dcai_cai1 lcai_cai1  lpolity2 llnwdi_pop llnwdi_gdpcapcon2010 lintllocation lcivillocation lv2lgfemleg  liarda_chcatpct  liarda_isgenpct GEO7  if Rst!=1 , cluster(ccode)
*outreg2 using Tableittrr1 ,  append word se label
ologit nonegLoTStateAgent Dcai_cai1 lcai_cai1  lpolity2 llnwdi_pop llnwdi_gdpcapcon2010 lintllocation lcivillocation lv2lgfemleg  liarda_chcatpct  liarda_isgenpct GEO7  if Rst!=1 , cluster(ccode)
*outreg2 using Tableittrr1 ,  append word se label





*Table 25: New results with ITT 
ologit nonegLoTC Dcai_cai2 lcai_cai2  lpolity2 llnwdi_pop llnwdi_gdpcapcon2010 lintllocation lcivillocation lv2lgfemleg  liarda_chcatpct  liarda_isgenpct GEO7  if Rst!=1 , cluster(ccode)
*outreg2 using Tableittrr ,  replace word se label
ologit nonegLoTD Dcai_cai2 lcai_cai2  lpolity2 llnwdi_pop llnwdi_gdpcapcon2010 lintllocation lcivillocation lv2lgfemleg  liarda_chcatpct  liarda_isgenpct GEO7  if Rst!=1 , cluster(ccode)
*outreg2 using Tableittrr ,  append word se label
ologit nonegLoTMa Dcai_cai2 lcai_cai2  lpolity2 llnwdi_pop llnwdi_gdpcapcon2010 lintllocation lcivillocation lv2lgfemleg  liarda_chcatpct  liarda_isgenpct GEO7  if Rst!=1 , cluster(ccode)
*outreg2 using Tableittrr ,  append word se label
ologit nonegLoTUnknown Dcai_cai2 lcai_cai2  lpolity2 llnwdi_pop llnwdi_gdpcapcon2010 lintllocation lcivillocation lv2lgfemleg  liarda_chcatpct  liarda_isgenpct GEO7  if Rst!=1 , cluster(ccode)
*outreg2 using Tableittrr ,  append word se label
ologit nonegLoTStateAgent Dcai_cai2 lcai_cai2  lpolity2 llnwdi_pop llnwdi_gdpcapcon2010 lintllocation lcivillocation lv2lgfemleg  liarda_chcatpct  liarda_isgenpct GEO7  if Rst!=1 , cluster(ccode)
*outreg2 using Tableittrr ,  append word se label
